class RuboCop::Cop::Layout::CommentIndentation

def autocorrect_preceding_comments(comment)

then correcting one more line, and so on.
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)
  comments = processed_source.comments
  index = comments.index(comment)
  comments[0..index]
    .reverse_each
    .each_cons(2)
    .take_while { |below, above| should_correct?(above, below) }
    .map { |_, above| autocorrect_one(above) }
end