Merge pull request #12819 from rolandcrosby/rubocop-cargo-lib

Formula: Allow `cargo build` when building libraries
This commit is contained in:
Mike McQuaid 2022-02-01 08:36:22 +00:00 committed by GitHub
commit 7a31b3bebf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

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

View File

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