Skip to content

Commit

Permalink
Merge pull request Homebrew#16086 from issyl0/revision-0-not-allowed-…
Browse files Browse the repository at this point in the history
…in-text
  • Loading branch information
MikeMcQuaid committed Oct 5, 2023
2 parents 561c122 + 5ddebe1 commit 1085afc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Library/Homebrew/rubocops/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def audit_formula(node, _class_node, _parent_class_node, body_node)
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
Expand Down
11 changes: 11 additions & 0 deletions Library/Homebrew/test/rubocops/text_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ class Foo < Formula
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
Expand Down

0 comments on commit 1085afc

Please sign in to comment.