class RuboCop::Cop::Style::DoubleCopDisableDirective
end
def f # rubocop:disable Style/For, Metrics/AbcSize
# if both fit on one line
# rubocop:enable Metrics/AbcSize
end
def f # rubocop:disable Style/For
# rubocop:disable Metrics/AbcSize
# good
end
def f # rubocop:disable Style/For # rubocop:disable Metrics/AbcSize
# bad
@example
automatically generated comments that need to be regenerated.
Detects double disable comments on one line. This is mostly to catch
def on_new_investigation
def on_new_investigation processed_source.comments.each do |comment| next unless comment.text.scan(/# rubocop:(?:disable|todo)/).size > 1 add_offense(comment) do |corrector| prefix = if comment.text.start_with?('# rubocop:disable') '# rubocop:disable' else '# rubocop:todo' end corrector.replace(comment, comment.text[/#{prefix} \S+/]) end end end