Merge pull request #16086 from issyl0/revision-0-not-allowed-in-text

This commit is contained in:
Mike McQuaid 2023-10-05 07:17:37 +01:00 committed by GitHub
commit 1085afcda5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -48,6 +48,10 @@ module RuboCop
problem "\"Formula.factory(name)\" is deprecated in favor of \"Formula[name]\""
end
find_method_with_args(body_node, :revision, 0) do
problem "\"revision 0\" is unnecessary"
end
find_method_with_args(body_node, :system, "xcodebuild") do
problem %q(use "xcodebuild *args" instead of "system 'xcodebuild', *args")
end

View File

@ -24,6 +24,17 @@ describe RuboCop::Cop::FormulaAudit::Text do
RUBY
end
it "reports an offense if 'revision 0' is present" do
expect_offense(<<~RUBY)
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
homepage "https://brew.sh"
revision 0
^^^^^^^^^^ FormulaAudit/Text: "revision 0" is unnecessary
end
RUBY
end
it "reports an offense if both openssl and libressl are dependencies" do
expect_offense(<<~RUBY)
class Foo < Formula