Class: Ducalis::RubocopDisable

Inherits:
RuboCop::Cop::Cop
  • Object
show all
Defined in:
lib/ducalis/cops/rubocop_disable.rb

Constant Summary collapse

OFFENSE =
<<-MESSAGE.gsub(/^ +\|\s/, '').strip
  | Please, do not suppress RuboCop metrics, may be you can introduce some refactoring or another concept.
MESSAGE

Instance Method Summary collapse

Instance Method Details

#investigate(processed_source) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/ducalis/cops/rubocop_disable.rb', line 11

def investigate(processed_source)
  return unless processed_source.ast

  processed_source.comments.each do |comment_node|
    next unless comment_node.loc.expression.source =~ /rubocop:disable/

    add_offense(comment_node, :expression, OFFENSE)
  end
end