Class: Rubocop::Cop::EmptyLineBetweenDefs
- Defined in:
- lib/rubocop/cop/empty_line_between_defs.rb
Constant Summary collapse
- MSG =
'Use empty lines between defs.'
Instance Attribute Summary
Attributes inherited from Cop
#debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, cop_name, #has_report?, inherited, #initialize, #inspect, #name, #on_comment
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#on_def(s) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rubocop/cop/empty_line_between_defs.rb', line 8 def on_def(s) def_start = s.loc.keyword.line def_end = s.loc.end.line if @prev_def_end && (def_start - @prev_def_end) < 2 add_offence(:convention, def_start, MSG) end @prev_def_end = def_end super end |