style: separate make commands
This commit is contained in:
		
							parent
							
								
									abbe2800b4
								
							
						
					
					
						commit
						bd8805b14f
					
				@ -858,9 +858,6 @@ module Homebrew
 | 
				
			|||||||
        )
 | 
					        )
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # TODO: check could be in RuboCop
 | 
					 | 
				
			||||||
      problem "Use separate make calls" if line.include?("make && make")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if line =~ /JAVA_HOME/i &&
 | 
					      if line =~ /JAVA_HOME/i &&
 | 
				
			||||||
         [formula.name, *formula.deps.map(&:name)].none? { |name| name.match?(/^openjdk(@|$)/) } &&
 | 
					         [formula.name, *formula.deps.map(&:name)].none? { |name| name.match?(/^openjdk(@|$)/) } &&
 | 
				
			||||||
         formula.requirements.none? { |req| req.is_a?(JavaRequirement) }
 | 
					         formula.requirements.none? { |req| req.is_a?(JavaRequirement) }
 | 
				
			||||||
 | 
				
			|||||||
@ -62,6 +62,13 @@ module RuboCop
 | 
				
			|||||||
          find_method_with_args(body_node, :system, "cargo", "build") do
 | 
					          find_method_with_args(body_node, :system, "cargo", "build") do
 | 
				
			||||||
            problem "use \"cargo\", \"install\", *std_cargo_args"
 | 
					            problem "use \"cargo\", \"install\", *std_cargo_args"
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          find_every_method_call_by_name(body_node, :system).each do |m|
 | 
				
			||||||
 | 
					            next unless parameters_passed?(m, /make && make/)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            offending_node(m)
 | 
				
			||||||
 | 
					            problem "Use separate `make` calls"
 | 
				
			||||||
 | 
					          end
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
				
			|||||||
@ -215,5 +215,16 @@ describe RuboCop::Cop::FormulaAudit::Text do
 | 
				
			|||||||
        end
 | 
					        end
 | 
				
			||||||
      RUBY
 | 
					      RUBY
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    it "When make calls are not separated" do
 | 
				
			||||||
 | 
					      expect_offense(<<~RUBY)
 | 
				
			||||||
 | 
					        class Foo < Formula
 | 
				
			||||||
 | 
					          def install
 | 
				
			||||||
 | 
					            system "make && make install"
 | 
				
			||||||
 | 
					            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use separate `make` calls
 | 
				
			||||||
 | 
					          end
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					      RUBY
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user