Sha256: da3848e9287135efe3fa7a182a71e9e3ca24d861c6fdfaf95a50b37dd3e50183
Contents?: true
Size: 607 Bytes
Versions: 5
Compression:
Stored size: 607 Bytes
Contents
# frozen_string_literal: true module SlimLint # This linter looks for trailing blank lines and a final newline. class Linter::TrailingBlankLines < Linter include LinterRegistry on_start do |_sexp| next if document.source.empty? sexp = Sexp.new(:dummy, start: [document.source.lines.size, 0], finish: [document.source.lines.size, 0]) if !document.source.end_with?("\n") report_lint(sexp, "No blank line in the end of file") elsif document.source.lines.last.blank? report_lint(sexp, "Multiple empty lines in the end of file") end end end end
Version data entries
5 entries across 5 versions & 1 rubygems