mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Do not report IsAFilter if there is a block with multiple args
This commit is contained in:
parent
320ec2ba75
commit
13605afe4a
2 changed files with 10 additions and 0 deletions
|
@ -26,6 +26,15 @@ module Ameba::Rule::Style
|
||||||
subject.catch(source).should_not be_valid
|
subject.catch(source).should_not be_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "does not report if there .is_a? call within block with multiple arguments" do
|
||||||
|
source = Source.new %(
|
||||||
|
t.all? { |_, v| v.is_a?(String) }
|
||||||
|
t.all? { |foo, bar| foo.is_a?(String) }
|
||||||
|
t.all? { |foo, bar| bar.is_a?(String) }
|
||||||
|
)
|
||||||
|
subject.catch(source).should be_valid
|
||||||
|
end
|
||||||
|
|
||||||
context "properties" do
|
context "properties" do
|
||||||
it "allows to configure filter_names" do
|
it "allows to configure filter_names" do
|
||||||
source = Source.new %(
|
source = Source.new %(
|
||||||
|
|
|
@ -52,6 +52,7 @@ module Ameba::Rule::Style
|
||||||
return unless (body = block.body).is_a?(Crystal::IsA)
|
return unless (body = block.body).is_a?(Crystal::IsA)
|
||||||
return unless (path = body.const).is_a?(Crystal::Path)
|
return unless (path = body.const).is_a?(Crystal::Path)
|
||||||
return unless body.obj.is_a?(Crystal::Var)
|
return unless body.obj.is_a?(Crystal::Var)
|
||||||
|
return if block.args.size > 1
|
||||||
|
|
||||||
name = path.names.join("::")
|
name = path.names.join("::")
|
||||||
name = "::#{name}" if path.global? && !body.nil_check?
|
name = "::#{name}" if path.global? && !body.nil_check?
|
||||||
|
|
Loading…
Reference in a new issue