Do not report unneeded disable directive if directive is used one line above

This commit is contained in:
Vitalii Elenhaupt 2018-05-09 00:14:46 +03:00
parent c7fc905413
commit 1fc0c525bd
No known key found for this signature in database
GPG key ID: 7558EF3A4056C706
4 changed files with 28 additions and 3 deletions

View file

@ -18,7 +18,16 @@ module Ameba::Rule
subject.catch(s).should be_valid
end
it "passes if there is disable directive and it is needed" do
it "doesn't report if there is disable directive and it is needed" do
s = Source.new %Q(
# ameba:disable #{NamedRule.name}
a = 1
)
s.error NamedRule.new, 3, 9, "Useless assignment", :disabled
subject.catch(s).should be_valid
end
it "passes if there is inline disable directive and it is needed" do
s = Source.new %Q(
a = 1 # ameba:disable #{NamedRule.name}
)