mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Autocorrect various rules (#253)
This commit is contained in:
parent
255d10f921
commit
63a6c73dc0
24 changed files with 676 additions and 175 deletions
|
@ -5,13 +5,15 @@ module Ameba::Rule::Layout
|
|||
|
||||
describe TrailingWhitespace do
|
||||
it "passes if all lines do not have trailing whitespace" do
|
||||
source = Source.new "no-whispace"
|
||||
subject.catch(source).should be_valid
|
||||
expect_no_issues subject, "no-whispace"
|
||||
end
|
||||
|
||||
it "fails if there is a line with trailing whitespace" do
|
||||
source = Source.new "whitespace at the end "
|
||||
subject.catch(source).should_not be_valid
|
||||
source = expect_issue subject,
|
||||
"whitespace at the end \n" \
|
||||
" # ^^ error: Trailing whitespace detected"
|
||||
|
||||
expect_correction source, "whitespace at the end"
|
||||
end
|
||||
|
||||
it "reports rule, pos and message" do
|
||||
|
@ -21,7 +23,7 @@ module Ameba::Rule::Layout
|
|||
issue = source.issues.first
|
||||
issue.rule.should_not be_nil
|
||||
issue.location.to_s.should eq "source.cr:2:7"
|
||||
issue.end_location.should be_nil
|
||||
issue.end_location.to_s.should eq "source.cr:2:7"
|
||||
issue.message.should eq "Trailing whitespace detected"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue