mirror of
				https://gitea.invidious.io/iv-org/shard-ameba.git
				synced 2024-08-15 00:53:29 +00:00 
			
		
		
		
	Remove buggy auto-correction from Performance/AnyInsteadOfEmpty rule
				
					
				
			This commit is contained in:
		
							parent
							
								
									f7cb5bb563
								
							
						
					
					
						commit
						6f0b6ffcd0
					
				
					 2 changed files with 3 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -14,14 +14,10 @@ module Ameba::Rule::Performance
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
    it "reports if there is any? call without a block nor argument" do
 | 
			
		||||
      source = expect_issue subject, <<-CRYSTAL
 | 
			
		||||
      expect_issue subject, <<-CRYSTAL
 | 
			
		||||
        [1, 2, 3].any?
 | 
			
		||||
                # ^^^^ error: Use `!{...}.empty?` instead of `{...}.any?`
 | 
			
		||||
        CRYSTAL
 | 
			
		||||
 | 
			
		||||
      expect_correction source, <<-CRYSTAL
 | 
			
		||||
        ![1, 2, 3].empty?
 | 
			
		||||
        CRYSTAL
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "does not report if source is a spec" do
 | 
			
		||||
| 
						 | 
				
			
			@ -32,14 +28,10 @@ module Ameba::Rule::Performance
 | 
			
		|||
 | 
			
		||||
    context "macro" do
 | 
			
		||||
      it "reports in macro scope" do
 | 
			
		||||
        source = expect_issue subject, <<-CRYSTAL
 | 
			
		||||
        expect_issue subject, <<-CRYSTAL
 | 
			
		||||
          {{ [1, 2, 3].any? }}
 | 
			
		||||
                     # ^^^^ error: Use `!{...}.empty?` instead of `{...}.any?`
 | 
			
		||||
          CRYSTAL
 | 
			
		||||
 | 
			
		||||
        expect_correction source, <<-CRYSTAL
 | 
			
		||||
          {{ ![1, 2, 3].empty? }}
 | 
			
		||||
          CRYSTAL
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue