Sha256: 879d208e709ea15a2fc44e93e13211e1c33e010d1ce17c6b9d8912360f21457d

Contents?: true

Size: 472 Bytes

Versions: 23

Compression:

Stored size: 472 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|
      max_length = config['max']
      dummy_node = Struct.new(:line)

      count = document.source_lines.size
      if count > max_length
        report_lint(dummy_node.new(1), format(MSG, count, max_length))
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
slim_lint-0.31.1 lib/slim_lint/linter/file_length.rb
slim_lint-0.31.0 lib/slim_lint/linter/file_length.rb
slim_lint-0.30.0 lib/slim_lint/linter/file_length.rb
slim_lint-0.29.0 lib/slim_lint/linter/file_length.rb
slim_lint-0.28.0 lib/slim_lint/linter/file_length.rb
slim_lint-0.27.0 lib/slim_lint/linter/file_length.rb
slim_lint-0.26.0 lib/slim_lint/linter/file_length.rb
slim_lint-0.25.0 lib/slim_lint/linter/file_length.rb
slim_lint-0.24.0 lib/slim_lint/linter/file_length.rb
slim_lint-0.23.0 lib/slim_lint/linter/file_length.rb
slim_lint-0.22.1 lib/slim_lint/linter/file_length.rb
slim_lint-0.22.0 lib/slim_lint/linter/file_length.rb
slim_lint-0.21.1 lib/slim_lint/linter/file_length.rb
slim_lint-0.21.0 lib/slim_lint/linter/file_length.rb
slim_lint-0.20.2 lib/slim_lint/linter/file_length.rb
slim_lint-0.20.1 lib/slim_lint/linter/file_length.rb
slim_lint-0.20.0 lib/slim_lint/linter/file_length.rb
slim_lint-0.19.0 lib/slim_lint/linter/file_length.rb
slim_lint-0.18.0 lib/slim_lint/linter/file_length.rb
slim_lint-0.17.1 lib/slim_lint/linter/file_length.rb