Sha256: 0d55e47b2e51a815b161d658e84b04637bf05ea87f5f6e563278c662ff5b7656

Contents?: true

Size: 471 Bytes

Versions: 5

Compression:

Stored size: 471 Bytes

Contents

# frozen_string_literal: true

module SlimLint
  # Searches for tab indentation
  class Linter::Tab < Linter
    include LinterRegistry

    TAB_RE = /^( *)[\t ]*\t/
    MSG = "Tab detected"

    on_start do |_sexp|
      document.source_lines.each.with_index(1) do |line, lineno|
        next unless TAB_RE.match?(line)

        sexp = Sexp.new(:dummy, start: [lineno, 0], finish: [lineno, ($` ? $`.size : 0)])
        report_lint(sexp, MSG)
      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/tab.rb
slim_lint_standard-0.0.2.1 lib/slim_lint/linter/tab.rb
slim_lint_standard-0.0.2 lib/slim_lint/linter/tab.rb
slim_lint_standard-0.0.1 lib/slim_lint/linter/tab.rb
slim_lint_standard-0.0.0 lib/slim_lint/linter/tab.rb