diff --git a/Library/Homebrew/rubocops/text_cop.rb b/Library/Homebrew/rubocops/text_cop.rb index 1546a9cc3c..701cb548f4 100644 --- a/Library/Homebrew/rubocops/text_cop.rb +++ b/Library/Homebrew/rubocops/text_cop.rb @@ -48,6 +48,11 @@ module RuboCop find_method_with_args(body_node, :system, "go", "get") do problem "Do not use `go get`. Please ask upstream to implement Go vendoring" end + + find_method_with_args(body_node, :system, "dep", "ensure") do |d| + next if parameters_passed?(d, /vendor-only/) + problem "use \"dep\", \"ensure\", \"-vendor-only\"" + 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 1b2d61d0c8..52881bfa13 100644 --- a/Library/Homebrew/test/rubocops/text_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/text_cop_spec.rb @@ -177,5 +177,19 @@ describe RuboCop::Cop::FormulaAudit::Text do end RUBY end + + it "When dep ensure is used without `-vendor-only`" do + expect_offense(<<~RUBY) + class Foo < Formula + url "http://example.com/foo-1.0.tgz" + homepage "http://example.com" + + def install + system "dep", "ensure" + ^^^^^^^^^^^^^^^^^^^^^^ use \"dep\", \"ensure\", \"-vendor-only\" + end + end + RUBY + end end end