rubocops/text: Declare "revision 0" in formulae as unnecessary
- This came up in a user contribution recently so here's a RuboCop for it.
This commit is contained in:
parent
ec5ad356a3
commit
5ddebe1640
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user