mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Refactor TypeNames
to report the name itself only
This commit is contained in:
parent
a8b8c35cc7
commit
547fec5a94
2 changed files with 4 additions and 4 deletions
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue