Skip to content

Commit

Permalink
Merge pull request #223 from ztion/add_line_numbers
Browse files Browse the repository at this point in the history
Add proper line numbers to result items.
  • Loading branch information
elbrujohalcon authored Mar 4, 2022
2 parents 3867682 + 2a57f09 commit 468bd34
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/elvis_style.erl
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ no_macros(ElvisConfig, RuleTarget, RuleConfig) ->
Acc;
false ->
{Line, _Col} = ktn_code:attr(location, MacroNode),
[elvis_result:new(item, ?NO_MACROS_MSG, [Macro, Line]) | Acc]
[elvis_result:new(item, ?NO_MACROS_MSG, [Macro, Line], Line) | Acc]
end
end,
[],
Expand Down Expand Up @@ -662,7 +662,7 @@ max_module_length(Config, Target, RuleConfig) ->
L when L > MaxLength ->
Info = [ModuleName, L, MaxLength],
Msg = ?MAX_MODULE_LENGTH,
Result = elvis_result:new(item, Msg, Info, 0),
Result = elvis_result:new(item, Msg, Info, 1),
[Result];
_ ->
[]
Expand Down Expand Up @@ -874,7 +874,7 @@ check_numeric_format(Regex, [NumNode | RemainingNumNodes], AccIn) ->
nomatch ->
{Line, _} = ktn_code:attr(location, NumNode),
Result = elvis_result:new(
item, ?NUMERIC_FORMAT_MSG, [Number, Line, Regex]),
item, ?NUMERIC_FORMAT_MSG, [Number, Line, Regex], Line),
[Result|AccIn];
{match, _} ->
AccIn
Expand Down Expand Up @@ -909,13 +909,13 @@ check_atom_names(Regex, RegexEnclosed, [AtomNode | RemainingAtomNodes], AccIn) -
Msg = ?ATOM_NAMING_CONVENTION_MSG,
{Line, _} = ktn_code:attr(location, AtomNode),
Info = [AtomName0, Line, Regex],
Result = elvis_result:new(item, Msg, Info),
Result = elvis_result:new(item, Msg, Info, Line),
AccIn ++ [Result];
nomatch when IsEnclosed->
Msg = ?ATOM_NAMING_CONVENTION_MSG,
{Line, _} = ktn_code:attr(location, AtomNode),
Info = [AtomName0, Line, RegexEnclosed],
Result = elvis_result:new(item, Msg, Info),
Result = elvis_result:new(item, Msg, Info, Line),
AccIn ++ [Result];
{match, _Captured} ->
AccIn
Expand Down Expand Up @@ -1005,7 +1005,7 @@ check_macro_names(Regexp, [MacroNode | RemainingMacroNodes], ResultsIn) ->
Msg = ?INVALID_MACRO_NAME_REGEX_MSG,
{Line, _} = ktn_code:attr(location, MacroNode),
Info = [MacroNameOriginal, Line, Regexp],
Result = elvis_result:new(item, Msg, Info),
Result = elvis_result:new(item, Msg, Info, Line),
ResultsIn ++ [Result];
{match, _Captured} ->
ResultsIn
Expand Down

0 comments on commit 468bd34

Please sign in to comment.