Class: Rubocop::Cop::Style::BlockComments

Inherits:
Cop
  • Object
show all
Defined in:
lib/rubocop/cop/style/block_comments.rb

Overview

This cop looks for uses of block comments (=begin...=end).

Constant Summary collapse

MSG =
'Do not use block comments.'

Constants inherited from Cop

Cop::OPERATOR_METHODS

Instance Attribute Summary

Attributes inherited from Cop

#config, #corrections, #offences, #processed_source

Instance Method Summary collapse

Methods inherited from Cop

#add_offence, all, #autocorrect?, #convention, #cop_config, cop_name, #cop_name, cop_type, #debug?, #ignore_node, inherited, #initialize, lint?, #message, non_rails, rails?, style?, #support_autocorrect?, #warning

Constructor Details

This class inherits a constructor from Rubocop::Cop::Cop

Instance Method Details

#investigate(processed_source) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rubocop/cop/style/block_comments.rb', line 10

def investigate(processed_source)
  processed_source.comments.each do |comment|
    if comment.text.start_with?('=begin')
      convention(comment, :expression)
    end
  end
end