rubocops/class: allow disabled formulae to be without a test block
This commit is contained in:
parent
b7efc64a58
commit
65885590ca
@ -71,6 +71,7 @@ module RuboCop
|
|||||||
class TestPresent < FormulaCop
|
class TestPresent < FormulaCop
|
||||||
def audit_formula(_node, class_node, _parent_class_node, body_node)
|
def audit_formula(_node, class_node, _parent_class_node, body_node)
|
||||||
return if find_block(body_node, :test)
|
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?
|
offending_node(class_node) if body_node.nil?
|
||||||
problem "A `test do` test block should be added"
|
problem "A `test do` test block should be added"
|
||||||
|
|||||||
@ -13,4 +13,14 @@ RSpec.describe RuboCop::Cop::FormulaAuditStrict::TestPresent do
|
|||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user