Sha256: ddd6d8b0a4b86f9df5ce3c4d36c25ff5a8f760bfb23be7e869076bc29fc173cc

Contents?: true

Size: 493 Bytes

Versions: 7

Compression:

Stored size: 493 Bytes

Contents

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|
      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

7 entries across 7 versions & 1 rubygems

Version Path
slim_lint-0.6.1 lib/slim_lint/linter/line_length.rb
slim_lint-0.6.0 lib/slim_lint/linter/line_length.rb
slim_lint-0.5.0 lib/slim_lint/linter/line_length.rb
slim_lint-0.4.0 lib/slim_lint/linter/line_length.rb
slim_lint-0.3.0 lib/slim_lint/linter/line_length.rb
slim_lint-0.2.0 lib/slim_lint/linter/line_length.rb
slim_lint-0.1.0 lib/slim_lint/linter/line_length.rb