Shadowing via short instance variable syntax

closes #122
This commit is contained in:
Vitalii Elenhaupt 2019-11-11 15:39:49 +02:00
parent fde321f7e6
commit 6b56c87e78
No known key found for this signature in database
GPG key ID: CD0BF17825928BC0
5 changed files with 55 additions and 1 deletions

View file

@ -151,6 +151,16 @@ module Ameba::Rule::Lint
subject.catch(source).should be_valid
end
it "does not report if argument shadows an ivar assignment" do
s = Source.new %(
def bar(@foo)
@foo.try do |foo|
end
end
)
subject.catch(s).should be_valid
end
it "reports rule, location and message" do
source = Source.new %(
foo = 1