style: separate make commands

This commit is contained in:
Rylan Polster 2020-07-03 16:27:35 -04:00
parent abbe2800b4
commit bd8805b14f
3 changed files with 18 additions and 3 deletions

View File

@ -858,9 +858,6 @@ module Homebrew
)
end
# TODO: check could be in RuboCop
problem "Use separate make calls" if line.include?("make && make")
if line =~ /JAVA_HOME/i &&
[formula.name, *formula.deps.map(&:name)].none? { |name| name.match?(/^openjdk(@|$)/) } &&
formula.requirements.none? { |req| req.is_a?(JavaRequirement) }

View File

@ -62,6 +62,13 @@ module RuboCop
find_method_with_args(body_node, :system, "cargo", "build") do
problem "use \"cargo\", \"install\", *std_cargo_args"
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

View File

@ -215,5 +215,16 @@ describe RuboCop::Cop::FormulaAudit::Text do
end
RUBY
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