Method: RuboCop::Cop::Style::DoubleCopDisableDirective#on_new_investigation

Defined in:
lib/rubocop/cop/style/double_cop_disable_directive.rb

#on_new_investigationObject



34
35
36
37
38
39
40
41
42
# File 'lib/rubocop/cop/style/double_cop_disable_directive.rb', line 34

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|
      corrector.replace(comment, comment.text.gsub(%r{ # rubocop:(disable|todo)}, ','))
    end
  end
end