Sha256: 28fe1719a3e31a085f61fe5fcd43afaed8628e977ca4c7a5ebdedaf85636e498

Contents?: true

Size: 449 Bytes

Versions: 5

Compression:

Stored size: 449 Bytes

Contents

# frozen_string_literal: true

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

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

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