Refactor TypeNames to report the name itself only

This commit is contained in:
Sijawusz Pur Rahnama 2023-11-14 03:37:03 +01:00
parent a8b8c35cc7
commit 547fec5a94
2 changed files with 4 additions and 4 deletions

View file

@ -8,7 +8,7 @@ module Ameba
rule = Rule::Naming::TypeNames.new
expect_issue rule, <<-CRYSTAL, type: type, name: name, file: file, line: line
%{type} %{name}; end
# ^{type}^{name}^^^^ error: Type name should be camelcased: #{expected}, but it was %{name}
_{type} # ^{name} error: Type name should be camelcased: #{expected}, but it was %{name}
CRYSTAL
end
end
@ -46,7 +46,7 @@ module Ameba
it "reports alias name" do
expect_issue subject, <<-CRYSTAL
alias Numeric_value = Int32
# ^{} error: Type name should be camelcased: NumericValue, but it was Numeric_value
# ^^^^^^^^^^^^^ error: Type name should be camelcased: NumericValue, but it was Numeric_value
CRYSTAL
end
end

View file

@ -63,7 +63,7 @@ module Ameba::Rule::Naming
expected = name.camelcase
return if name == expected
issue_for node, MSG % {expected, name}
issue_for node.name, MSG % {expected, name}
end
end
end