Sha256: 4aad635d697f0f40635ff8fcbdda6769ca9c45f7658bd422075af437db1e4460

Contents?: true

Size: 491 Bytes

Versions: 5

Compression:

Stored size: 491 Bytes

Contents

# frozen_string_literal: true

module SlimLint
  # Checks for lines longer than a maximum number of columns.
  class Linter::LineLength < Linter
    include LinterRegistry

    MSG = "Line is too long. [%d/%d]"

    on_start do |_sexp|
      document.source_lines.each.with_index(1) do |line, i|
        next if line.length <= config["max"]
        sexp = Sexp.new(start: [i, 0], finish: [i, 0])
        report_lint(sexp, format(MSG, line.length, config["max"]))
      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/line_length.rb
slim_lint_standard-0.0.2.1 lib/slim_lint/linter/line_length.rb
slim_lint_standard-0.0.2 lib/slim_lint/linter/line_length.rb
slim_lint_standard-0.0.1 lib/slim_lint/linter/line_length.rb
slim_lint_standard-0.0.0 lib/slim_lint/linter/line_length.rb