Skip to content

Commit

Permalink
simplify node tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
bormilan committed Oct 18, 2024
1 parent 7b85321 commit 379a088
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/elvis_style.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1131,12 +1131,11 @@ no_init_lists(Config, Target, RuleConfig) ->
FunctionNodes = elvis_code:find(IsFunction, Root),
ProcessFun =
fun(FunctionNode) ->
Name = ktn_code:attr(name, FunctionNode),
Location = ktn_code:attr(location, FunctionNode),
Content = ktn_code:content(FunctionNode),
lists:map(fun(Elem) ->
Attributes = ktn_code:node_attr(pattern, Elem),
{Name, Location, Attributes}
{Location, Attributes}
end,
Content)
end,
Expand All @@ -1157,13 +1156,13 @@ no_init_lists(Config, Target, RuleConfig) ->
end,

IsBreakRule =
lists:all(fun({_, _, Attributes}) ->
lists:all(fun({_, Attributes}) ->
length(lists:filter(fun(Elem) -> is_list_node(Elem) end, Attributes)) =:= 1
end,
InitFuns),

ResultFun =
fun({_, Location, _}) ->
fun({Location, _}) ->
Info = [Location],
Msg = ?NO_INIT_LISTS_MSG,
elvis_result:new(item, Msg, Info, Location)
Expand Down

0 comments on commit 379a088

Please sign in to comment.