Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rubocops/text: Declare "revision 0" in formulae as unnecessary #16086

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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