Class: Rubocop::Cop::EmptyLines
- Defined in:
- lib/rubocop/cop/empty_lines.rb
Constant Summary collapse
- ERROR_MESSAGE =
'Extra blank line detected.'
Instance Attribute Summary
Attributes inherited from Cop
#correlations, #debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, cop_name, #has_report?, inherited, #initialize, #name
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#inspect(file, source, tokens, sexp) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rubocop/cop/empty_lines.rb', line 8 def inspect(file, source, tokens, sexp) previous_token = Token.new(0, :init, '') tokens.each do |t| if t.type == :on_ignored_nl && previous_token.type == :on_ignored_nl add_offence(:convention, t.pos.lineno, ERROR_MESSAGE) end previous_token = t end end |