diff --git a/Library/Homebrew/rubocops/text_cop.rb b/Library/Homebrew/rubocops/text_cop.rb index 701cb548f4..e9b648e281 100644 --- a/Library/Homebrew/rubocops/text_cop.rb +++ b/Library/Homebrew/rubocops/text_cop.rb @@ -53,6 +53,10 @@ module RuboCop next if parameters_passed?(d, /vendor-only/) problem "use \"dep\", \"ensure\", \"-vendor-only\"" end + + find_method_with_args(body_node, :system, "cargo", "build") do + problem "use \"cargo\", \"install\", \"--root\", prefix" + end end end end diff --git a/Library/Homebrew/test/rubocops/text_cop_spec.rb b/Library/Homebrew/test/rubocops/text_cop_spec.rb index 52881bfa13..3f5d8f10a1 100644 --- a/Library/Homebrew/test/rubocops/text_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/text_cop_spec.rb @@ -191,5 +191,19 @@ describe RuboCop::Cop::FormulaAudit::Text do end RUBY end + + it "When cargo build is executed" do + expect_offense(<<~RUBY) + class Foo < Formula + url "http://example.com/foo-1.0.tgz" + homepage "http://example.com" + + def install + system "cargo", "build" + ^^^^^^^^^^^^^^^^^^^^^^^ use \"cargo\", \"install\", \"--root\", prefix + end + end + RUBY + end end end