Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Act on non_reversible_form as an exception to atom naming conventions #345

Merged
merged 3 commits into from
Jun 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/elvis_style.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1413,13 +1413,15 @@ is_float_node(Node) ->
ktn_code:type(Node) =:= float.

%% @private
is_exception_class(error) ->
is_exception_or_non_reversible(error) ->
true;
is_exception_class(exit) ->
is_exception_or_non_reversible(exit) ->
true;
is_exception_class(throw) ->
is_exception_or_non_reversible(throw) ->
true;
is_exception_class(_) ->
is_exception_or_non_reversible(non_reversible_form) ->
true;
is_exception_or_non_reversible(_) ->
false.

%% @private
Expand All @@ -1429,7 +1431,7 @@ check_atom_names(Regex, RegexEnclosed, [AtomNode | RemainingAtomNodes], AccIn) -
AtomName0 = ktn_code:attr(text, AtomNode),
ValueAtomName = ktn_code:attr(value, AtomNode),
{IsEnclosed, AtomName} = string_strip_enclosed(AtomName0),
IsExceptionClass = is_exception_class(ValueAtomName),
IsExceptionClass = is_exception_or_non_reversible(ValueAtomName),
RE = re_compile_for_atom_type(IsEnclosed, Regex, RegexEnclosed),
AccOut =
case re:run(
Expand Down