class Rubocop::Cop::Style::TrailingBlankLines

This cop looks for trailing blank lines in the source code.

def autocorrect(range)

def autocorrect(range)
  # Bail out if there's also trailing whitespace, because
  # auto-correction in the two cops would result in clobbering.
  if range.source =~ / / &&
      config.for_cop('TrailingWhitespace')['Enabled']
    return
  end
  @corrections << ->(corrector) { corrector.remove(range) }
end

def investigate(processed_source)

def investigate(processed_source)
  blank_lines = 0
  processed_source.lines.reverse_each do |line|
    if line.blank?
      blank_lines += 1
    else
      break
    end
  end
  if blank_lines > 0
    range_size =
      processed_source.raw_lines.to_a[-blank_lines..-1].join.length
    range = source_range(processed_source.buffer,
                         processed_source[0...-blank_lines],
                         0, range_size)
    add_offense(range, range, format(MSG, blank_lines))
  end
end