mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Track issue.end_location properly
This commit is contained in:
parent
ad2c6bad0e
commit
9885457227
45 changed files with 90 additions and 20 deletions
|
@ -43,6 +43,7 @@ module Ameba
|
|||
issue = s.issues.first
|
||||
issue.rule.should_not be_nil
|
||||
issue.location.to_s.should eq "source.cr:1:1"
|
||||
issue.end_location.to_s.should eq "source.cr:1:9"
|
||||
issue.message.should eq(
|
||||
"Constant name should be screaming-cased: CONST, not Const"
|
||||
)
|
||||
|
|
|
@ -118,6 +118,7 @@ module Ameba
|
|||
issue = s.issues.first
|
||||
issue.rule.should_not be_nil
|
||||
issue.location.to_s.should eq "source.cr:1:1"
|
||||
issue.end_location.should be_nil
|
||||
issue.message.should match /1_200_000/
|
||||
end
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ module Ameba
|
|||
issue = s.issues.first
|
||||
issue.rule.should_not be_nil
|
||||
issue.location.to_s.should eq "source.cr:1:1"
|
||||
issue.end_location.to_s.should eq "source.cr:2:3"
|
||||
issue.message.should eq(
|
||||
"Method name should be underscore-cased: bad_name, not bad_Name"
|
||||
)
|
||||
|
|
|
@ -62,6 +62,7 @@ module Ameba::Rule::Style
|
|||
issue = s.issues.first
|
||||
issue.rule.should_not be_nil
|
||||
issue.location.to_s.should eq "source.cr:1:1"
|
||||
issue.end_location.to_s.should eq "source.cr:1:21"
|
||||
issue.message.should eq "Avoid negated conditions in unless blocks"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -41,6 +41,7 @@ module Ameba::Rule::Style
|
|||
issue = s.issues.first
|
||||
issue.rule.should_not be_nil
|
||||
issue.location.to_s.should eq "source.cr:2:3"
|
||||
issue.end_location.to_s.should eq "source.cr:4:5"
|
||||
issue.message.should eq(
|
||||
"Favour method name 'picture?' over 'has_picture?'")
|
||||
end
|
||||
|
|
|
@ -220,6 +220,7 @@ module Ameba::Rule::Style
|
|||
issue = s.issues.first
|
||||
issue.rule.should_not be_nil
|
||||
issue.location.to_s.should eq "source.cr:1:1"
|
||||
issue.end_location.to_s.should eq "source.cr:7:3"
|
||||
issue.message.should eq "Redundant `begin` block detected"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,6 +52,7 @@ module Ameba
|
|||
issue = s.issues.first
|
||||
issue.rule.should_not be_nil
|
||||
issue.location.to_s.should eq "source.cr:1:1"
|
||||
issue.end_location.to_s.should eq "source.cr:2:3"
|
||||
issue.message.should eq(
|
||||
"Type name should be camelcased: MyClass, but it was My_class"
|
||||
)
|
||||
|
|
|
@ -38,6 +38,7 @@ module Ameba::Rule::Style
|
|||
issue.should_not be_nil
|
||||
issue.rule.should_not be_nil
|
||||
issue.location.to_s.should eq "source.cr:1:1"
|
||||
issue.end_location.to_s.should eq "source.cr:5:3"
|
||||
issue.message.should eq "Favour if over unless with else"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -53,6 +53,7 @@ module Ameba
|
|||
issue = s.issues.first
|
||||
issue.rule.should_not be_nil
|
||||
issue.location.to_s.should eq "source.cr:1:1"
|
||||
issue.end_location.to_s.should eq "source.cr:1:7"
|
||||
issue.message.should eq(
|
||||
"Var name should be underscore-cased: bad_name, not badName"
|
||||
)
|
||||
|
|
|
@ -36,6 +36,7 @@ module Ameba::Rule::Style
|
|||
|
||||
issue = source.issues.first
|
||||
issue.location.to_s.should eq "source.cr:2:1"
|
||||
issue.end_location.to_s.should eq "source.cr:5:3"
|
||||
issue.message.should eq "While statement using true literal as condition"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue