Merge pull request #17614 from Homebrew/bayandin/allow-no-test-block-for-disabled-formulae

This commit is contained in:
Mike McQuaid 2024-07-03 12:51:00 +01:00 committed by GitHub
commit 7aa2b15965
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -71,6 +71,7 @@ module RuboCop
class TestPresent < FormulaCop
def audit_formula(_node, class_node, _parent_class_node, body_node)
return if find_block(body_node, :test)
return if find_node_method_by_name(body_node, :disable!)
offending_node(class_node) if body_node.nil?
problem "A `test do` test block should be added"

View File

@ -13,4 +13,14 @@ RSpec.describe RuboCop::Cop::FormulaAuditStrict::TestPresent do
end
RUBY
end
it "reports no offenses when there is no test block and formula is disabled" do
expect_no_offenses(<<~RUBY)
class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz'
disable! date: "2024-07-03", because: :unsupported
end
RUBY
end
end