diff --git a/src/elvis_style.erl b/src/elvis_style.erl index 34776524..5329914d 100644 --- a/src/elvis_style.erl +++ b/src/elvis_style.erl @@ -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). @@ -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). @@ -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). diff --git a/test/style_SUITE.erl b/test/style_SUITE.erl index 84327b8c..d7c2cf55 100644 --- a/test/style_SUITE.erl +++ b/test/style_SUITE.erl @@ -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().