class RuboCop::Cop::Layout::CommentIndentation
def autocorrect_preceding_comments(comment)
of correcting, saving the file, parsing and inspecting again, and
comment and have the same indentation. This is to avoid a long chain
Corrects all comment lines that occur immediately before the given
def autocorrect_preceding_comments(comment) corrections = [] line_no = comment.loc.line column = comment.loc.column comments = processed_source.comments (comments.index(comment) - 1).downto(0) do |ix| previous_comment = comments[ix] break unless should_correct?(previous_comment, column, line_no - 1) corrections << autocorrect_one(previous_comment) line_no -= 1 end corrections end