Sha256: 7ecc6677cfc00a67c43713d36763b6db16847b0aa8e1ec8eb6c62dadf6fdb58a

Contents?: true

Size: 531 Bytes

Versions: 15

Compression:

Stored size: 531 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]'.freeze

    on_start do |_sexp|
      max_length = config['max']
      dummy_node = Struct.new(:line)

      document.source_lines.each_with_index do |line, index|
        next if line.length <= max_length

        report_lint(dummy_node.new(index + 1), format(MSG, line.length, max_length))
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
slim_lint-0.15.1 lib/slim_lint/linter/line_length.rb
slim_lint-0.15.0 lib/slim_lint/linter/line_length.rb
slim_lint-0.14.0 lib/slim_lint/linter/line_length.rb
slim_lint-0.13.0 lib/slim_lint/linter/line_length.rb
slim_lint-0.12.0 lib/slim_lint/linter/line_length.rb
slim_lint-0.11.0 lib/slim_lint/linter/line_length.rb
slim_lint-0.10.0 lib/slim_lint/linter/line_length.rb
slim_lint-0.9.0 lib/slim_lint/linter/line_length.rb
slim_lint-0.8.3 lib/slim_lint/linter/line_length.rb
slim_lint-0.8.2 lib/slim_lint/linter/line_length.rb
slim_lint-0.8.1 lib/slim_lint/linter/line_length.rb
slim_lint-0.8.0 lib/slim_lint/linter/line_length.rb
slim_lint-0.7.2 lib/slim_lint/linter/line_length.rb
slim_lint-0.7.1 lib/slim_lint/linter/line_length.rb
slim_lint-0.7.0 lib/slim_lint/linter/line_length.rb