-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide test example of using lints from config
Summary: We are able to specify a limited set of lints from a config file. Provide an end-to-end test example of how to use this. Reviewed By: robertoaloi Differential Revision: D58779864 fbshipit-source-id: 6f3e185ee021a0752bb5b9108de236919aed25ec
- Loading branch information
1 parent
c2206f4
commit f7a3a14
Showing
4 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
crates/elp/src/resources/test/lint/from_config/app_b/src/app_b.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-module(app_b). | ||
-export([application_env_error/0]). | ||
|
||
application_env_error() -> | ||
ok. |
16 changes: 16 additions & 0 deletions
16
crates/elp/src/resources/test/linter/parse_elp_lint_adhoc_output.stdout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module specified: app_b | ||
Diagnostics reported in 1 modules: | ||
app_b: 1 | ||
4:4-4:34::[WeakWarning] [ad-hoc: application:get_env/2] 'application:get_env/2' called | ||
--------------------------------------------- | ||
|
||
Applying fix in module 'app_b' for | ||
4:4-4:34::[WeakWarning] [ad-hoc: application:get_env/2] 'application:get_env/2' called | ||
@@ -1,5 +1,5 @@ | ||
-module(app_b). | ||
-export([application_env_error/0]). | ||
|
||
application_env_error() -> | ||
- application:get_env(misc, key). | ||
+ ok. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
enabled_lints = ["ad-hoc: application:get_env/2"] | ||
# disabled_lints = [] | ||
|
||
[[ad_hoc_lints.lints]] | ||
type = "ReplaceCall" | ||
|
||
[ad_hoc_lints.lints.matcher] | ||
type = "MFA" | ||
module = "application" | ||
name = "get_env" | ||
arity = 2 | ||
|
||
[ad_hoc_lints.lints.action] | ||
action = "Replace" | ||
type = "UseOk" |