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

@ -7,8 +7,8 @@ module Ameba
it "reports type name #{expected}", file, line do it "reports type name #{expected}", file, line do
rule = Rule::Naming::TypeNames.new rule = Rule::Naming::TypeNames.new
expect_issue rule, <<-CRYSTAL, type: type, name: name, file: file, line: line expect_issue rule, <<-CRYSTAL, type: type, name: name, file: file, line: line
%{type} %{name}; end %{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 CRYSTAL
end end
end end
@ -46,7 +46,7 @@ module Ameba
it "reports alias name" do it "reports alias name" do
expect_issue subject, <<-CRYSTAL expect_issue subject, <<-CRYSTAL
alias Numeric_value = Int32 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 CRYSTAL
end end
end end

View file

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