-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #355 from bormilan/feature/prefer-unquoted-atoms
feat(#297): New rule: Prefer Unquoted Atoms
- Loading branch information
Showing
6 changed files
with
103 additions
and
4 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
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 @@ | ||
# Prefer unquoted atoms | ||
|
||
Do not use quotes on atoms that don't need to be quoted. | ||
|
||
> Works on `.beam` file? No. | ||
## Options | ||
|
||
- None. | ||
|
||
## Example | ||
|
||
```erlang | ||
{elvis_style, prefer_unquoted_atoms, #{}} | ||
``` |
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
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,11 @@ | ||
-module(fail_quoted_atoms). | ||
|
||
-export([test/1, test/2]). | ||
|
||
-define(TEST(), test(1, default)). | ||
|
||
test(_Test) -> {ok, test}. | ||
|
||
test(_A, 'ugly_atom_name') -> 'why_use_quotes_here'; | ||
test(_A, default) -> ?TEST(); | ||
test(_A, _B) -> 'and'. |
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,11 @@ | ||
-module(pass_unquoted_atoms). | ||
|
||
-export([test/1, test/2]). | ||
|
||
test(_Test) -> ok. | ||
|
||
test(_A, nice_atom_name) -> perfect_atomname; | ||
test(_Reserved, _Words) -> ['after', 'and', 'andalso', 'band', 'begin', 'bnot', 'bor', 'bsl', 'bsr', 'bxor', 'case', | ||
'catch', 'cond', 'div', 'end', 'fun', 'if', 'let', 'not', 'of', 'or', 'orelse', 'receive', | ||
'rem', 'try', 'when', 'xor', 'maybe']. | ||
|
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