Skip to content

Commit

Permalink
Merge pull request #347 from zsoci/main
Browse files Browse the repository at this point in the history
Add Line to relevant calls (#346)
  • Loading branch information
elbrujohalcon authored Jun 10, 2024
2 parents 1764ff1 + fdbf4d8 commit fe55f05
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/elvis_style.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ no_throw(Config, Target, RuleConfig) ->
ThrowNodes = elvis_code:find(Zipper, Root),
lists:foldl(fun(ThrowNode, AccIn) ->
{Line, _} = ktn_code:attr(location, ThrowNode),
[elvis_result:new(item, ?NO_THROW_MSG, [Line]) | AccIn]
[elvis_result:new(item, ?NO_THROW_MSG, [Line], Line) | AccIn]
end,
[],
ThrowNodes).
Expand All @@ -1040,7 +1040,7 @@ no_dollar_space(Config, Target, RuleConfig) ->
DollarSpaceNodes = elvis_code:find(IsDollarSpace, Root, Opts),
lists:map(fun(ThrowNode) ->
{Line, _} = ktn_code:attr(location, ThrowNode),
elvis_result:new(item, ?NO_DOLLAR_SPACE_MSG, [Line])
elvis_result:new(item, ?NO_DOLLAR_SPACE_MSG, [Line], Line)
end,
DollarSpaceNodes).

Expand Down Expand Up @@ -1079,7 +1079,7 @@ no_catch_expressions(Config, Target, RuleConfig) ->
CatchNodes = elvis_code:find(fun is_catch_node/1, Root),
lists:foldl(fun(CatchNode, Acc) ->
{Line, _Col} = ktn_code:attr(location, CatchNode),
[elvis_result:new(item, ?NO_CATCH_EXPRESSIONS_MSG, [Line]) | Acc]
[elvis_result:new(item, ?NO_CATCH_EXPRESSIONS_MSG, [Line], Line) | Acc]
end,
[],
CatchNodes).
Expand Down
4 changes: 2 additions & 2 deletions test/style_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1454,9 +1454,9 @@ verify_no_catch_expressions(Config) ->
R = elvis_core_apply_rule(Config, elvis_style, no_catch_expressions, #{}, FailPath),
_ = case Group of
beam_files ->
[#{info := [21]}, #{info := [21]}, #{info := [10]}] = R;
[#{info := [10]}, #{info := [21]}, #{info := [21]}] = lists:sort(R);
erl_files ->
[#{info := [26]}, #{info := [24]}, #{info := [9]}] = R
[#{info := [9]}, #{info := [24]}, #{info := [26]}] = lists:sort(R)
end.

-spec verify_no_single_clause_case(config()) -> any().
Expand Down

0 comments on commit fe55f05

Please sign in to comment.