Class: RuboCop::Cop::DisableComment Private

Inherits:
Base
  • Object
show all
Defined in:
rubocops/disable_comment.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Checks if rubocop disable comments have a clarifying comment preceding them.

Constant Summary collapse

MSG =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

"Add a clarifying comment to the RuboCop disable comment"

Instance Method Summary collapse

Instance Method Details

#on_new_investigationvoid

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.



11
12
13
14
15
16
17
18
19
20
# File 'rubocops/disable_comment.rb', line 11

def on_new_investigation
  super

  processed_source.comments.each do |comment|
    next unless disable_comment?(comment)
    next if comment?(processed_source[comment.loc.line - 2])

    add_offense(comment)
  end
end