Skip to content

Commit

Permalink
Use contains_comment? instead of deprecated API
Browse files Browse the repository at this point in the history
Follow up #8405.
  • Loading branch information
koic committed Sep 18, 2022
1 parent 1670e9e commit 538b0d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/rubocop/cop/lint/empty_class.rb
Expand Up @@ -85,7 +85,9 @@ def on_sclass(node)
private

def body_or_allowed_comment_lines?(node)
node.body || (cop_config['AllowComments'] && comment_lines?(node))
return true if node.body

cop_config['AllowComments'] && processed_source.contains_comment?(node.source_range)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/style/empty_method.rb
Expand Up @@ -52,7 +52,7 @@ class EmptyMethod < Base
MSG_EXPANDED = 'Put the `end` of empty method definitions on the next line.'

def on_def(node)
return if node.body || comment_lines?(node)
return if node.body || processed_source.contains_comment?(node.source_range)
return if correct_style?(node)

add_offense(node) do |corrector|
Expand Down

0 comments on commit 538b0d8

Please sign in to comment.