Sha256: 87ac0f41eeee8a91bac4417c17fb7bbf9a8e3f688d14ad77c7565ead6c52730f

Contents?: true

Size: 472 Bytes

Versions: 5

Compression:

Stored size: 472 Bytes

Contents

# frozen_string_literal: true

module SlimLint
  # Checks for trailing whitespace.
  class Linter::TrailingWhitespace < Linter
    include LinterRegistry

    on_start do |_sexp|
      document.source_lines.each.with_index(1) do |line, lineno|
        next unless /\s+$/.match?(line)

        sexp = Sexp.new(:dummy, start: [lineno, line.rstrip.size], finish: [lineno, line.size])
        report_lint(sexp, "Line contains trailing whitespace")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slim_lint_standard-0.0.2.2 lib/slim_lint/linter/trailing_whitespace.rb
slim_lint_standard-0.0.2.1 lib/slim_lint/linter/trailing_whitespace.rb
slim_lint_standard-0.0.2 lib/slim_lint/linter/trailing_whitespace.rb
slim_lint_standard-0.0.1 lib/slim_lint/linter/trailing_whitespace.rb
slim_lint_standard-0.0.0 lib/slim_lint/linter/trailing_whitespace.rb