Merge pull request #4311 from commitay/cargo-install

text_cop: require cargo to use `install` instead of `build`
This commit is contained in:
ilovezfs 2018-06-10 06:44:18 -07:00 committed by GitHub
commit 00e30245b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -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

View File

@ -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