mirror of
				https://gitea.invidious.io/iv-org/shard-ameba.git
				synced 2024-08-15 00:53:29 +00:00 
			
		
		
		
	Merge pull request #216 from crystal-ameba/is_a_filter_in_multi_args_block
Do not report IsAFilter if there is a block with multiple args
This commit is contained in:
		
						commit
						f4ffb8a287
					
				
					 2 changed files with 10 additions and 0 deletions
				
			
		|  | @ -26,6 +26,15 @@ module Ameba::Rule::Style | |||
|       subject.catch(source).should_not be_valid | ||||
|     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 | ||||
|       it "allows to configure filter_names" do | ||||
|         source = Source.new %( | ||||
|  |  | |||
|  | @ -52,6 +52,7 @@ module Ameba::Rule::Style | |||
|       return unless (body = block.body).is_a?(Crystal::IsA) | ||||
|       return unless (path = body.const).is_a?(Crystal::Path) | ||||
|       return unless body.obj.is_a?(Crystal::Var) | ||||
|       return if block.args.size > 1 | ||||
| 
 | ||||
|       name = path.names.join("::") | ||||
|       name = "::#{name}" if path.global? && !body.nil_check? | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue