Skip to content

Commit 3fbbca6

Browse files
authored
Merge pull request #1460 from Earlopain/future-proof-rails-output
Future-proof `Rails/Output` for `itblock`
2 parents 930584a + 84d09f5 commit 3fbbca6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/rubocop/cop/rails/output.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class Output < Base
2323

2424
MSG = "Do not write to stdout. Use Rails's logger if you want to log."
2525
RESTRICT_ON_SEND = %i[ap p pp pretty_print print puts binwrite syswrite write write_nonblock].freeze
26-
ALLOWED_TYPES = %i[send csend block numblock].freeze
2726

2827
def_node_matcher :output?, <<~PATTERN
2928
(send nil? {:ap :p :pp :pretty_print :print :puts} ...)
@@ -40,7 +39,7 @@ class Output < Base
4039
PATTERN
4140

4241
def on_send(node)
43-
return if ALLOWED_TYPES.include?(node.parent&.type)
42+
return if node.parent&.call_type? || node.block_node
4443
return if !output?(node) && !io_output?(node)
4544

4645
range = offense_range(node)

0 commit comments

Comments
 (0)