rubocops/class: allow disabled formulae to be without a test block

This commit is contained in:
Alexander Bayandin 2024-07-03 10:24:40 +01:00
parent b7efc64a58
commit 65885590ca
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