class RuboCop::Cop::Style::InlineComment
end
f.bar # Trailing inline comment
foo.each do |f|
# bad
end
f.bar
# Standalone comment
foo.each do |f|
# good
@example
This cop checks for trailing inline comments.
def investigate(processed_source)
def investigate(processed_source) processed_source.each_comment do |comment| next if comment_line?(processed_source[comment.loc.line - 1]) || comment.text.match(/\A# rubocop:(enable|disable)/) add_offense(comment) end end