diff --git a/Library/Homebrew/rubocops/text.rb b/Library/Homebrew/rubocops/text.rb index 6f2beaf50e..9ed0887b28 100644 --- a/Library/Homebrew/rubocops/text.rb +++ b/Library/Homebrew/rubocops/text.rb @@ -70,7 +70,9 @@ module RuboCop problem "use \"dep\", \"ensure\", \"-vendor-only\"" end - find_method_with_args(body_node, :system, "cargo", "build") do + find_method_with_args(body_node, :system, "cargo", "build") do |m| + next if parameters_passed?(m, /--lib/) + problem "use \"cargo\", \"install\", *std_cargo_args" end diff --git a/Library/Homebrew/test/rubocops/text_spec.rb b/Library/Homebrew/test/rubocops/text_spec.rb index b8ae63dbd1..26edf5e3dd 100644 --- a/Library/Homebrew/test/rubocops/text_spec.rb +++ b/Library/Homebrew/test/rubocops/text_spec.rb @@ -205,6 +205,19 @@ describe RuboCop::Cop::FormulaAudit::Text do RUBY end + it "doesn't reports an offense if `cargo build` is executed with --lib" do + expect_no_offenses(<<~RUBY) + class Foo < Formula + url "https://brew.sh/foo-1.0.tgz" + homepage "https://brew.sh" + + def install + system "cargo", "build", "--lib" + end + end + RUBY + end + it "reports an offense if `make` calls are not separated" do expect_offense(<<~RUBY) class Foo < Formula