Class: RuboCop::Cop::Yoshiki::Layout::EmptyLineBeforeComment
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Yoshiki::Layout::EmptyLineBeforeComment
- Extended by:
- AutoCorrector
- Includes:
- RangeHelp
- Defined in:
- lib/rubocop/cop/yoshiki/layout/empty_line_before_comment.rb
Overview
Requires a blank line before a full-line comment group when the previous physical line is code at the same indent.
Consecutive # lines and a =begin/=end document are each one
group: one blank before the first line, nothing inserted inside.
=begin is always column 0, so it still gets a blank when the
preceding code is indented.
Trailing comments stay on their code line. A # comment that opens a
body (class / module / def / do / begin / {) sits deeper
than the opener, so it is left alone. Extra indent is not a
substitute for a blank — Layout/CommentIndentation will pull those
comments back.
# rubocop: directives glue to the code they apply to.
# rubocop:enable in particular frequently trails a region and
must not grow a blank line.
Constant Summary collapse
- MSG =
'Add a blank line before this comment.'.freeze
Instance Method Summary collapse
Instance Method Details
#on_new_investigation ⇒ Object
76 77 78 |
# File 'lib/rubocop/cop/yoshiki/layout/empty_line_before_comment.rb', line 76 def on_new_investigation processed_source.comments.each { inspect_comment(it) } end |