text_cop: require cargo to use install instead of build

This commit is contained in:
commitay 2018-06-08 10:15:32 +10:00
parent 9ebcef785e
commit 3329a9f6d8
2 changed files with 18 additions and 0 deletions

View File

@ -53,6 +53,10 @@ module RuboCop
next if parameters_passed?(d, /vendor-only/) next if parameters_passed?(d, /vendor-only/)
problem "use \"dep\", \"ensure\", \"-vendor-only\"" problem "use \"dep\", \"ensure\", \"-vendor-only\""
end end
find_method_with_args(body_node, :system, "cargo", "build") do
problem "use \"cargo\", \"install\", \"--root\", prefix"
end
end end
end end
end end

View File

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