Sha256: 54d8e89ba46a463b566ff535bca0c49cfd4e0c878a3d4326f267282ce994b56e

Contents?: true

Size: 595 Bytes

Versions: 3

Compression:

Stored size: 595 Bytes

Contents

module SlimLint
  # This linter checks for two or more consecutive blank lines
  # and for the first blank line in file.
  class Linter::EmptyLines < Linter
    include LinterRegistry

    on_start do |_sexp|
      dummy_node = Struct.new(:line)

      was_empty = true
      document.source.lines.each_with_index do |line, i|
        if line.blank?
          if was_empty
            report_lint(dummy_node.new(i + 1),
                        'Extra empty line detected')
          end
          was_empty = true
        else
          was_empty = false
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slim_lint-0.15.1 lib/slim_lint/linter/empty_lines.rb
slim_lint-0.15.0 lib/slim_lint/linter/empty_lines.rb
slim_lint-0.14.0 lib/slim_lint/linter/empty_lines.rb