Sha256: 1dec6c021439100aeb70d8445a502f5de9f3e3ab4ad54d0e8b0791f0b41c2cc4

Contents?: true

Size: 476 Bytes

Versions: 25

Compression:

Stored size: 476 Bytes

Contents

# frozen_string_literal: true

module PlatformosCheck
  class TemplateLength < LiquidCheck
    severity :suggestion
    category :liquid
    doc docs_url(__FILE__)

    def initialize(max_length: 600)
      @max_length = max_length
    end

    def after_document(node)
      lines = node.app_file.source.count("\n")
      return unless lines > @max_length

      add_offense("Template has too many lines [#{lines}/#{@max_length}]", app_file: node.app_file)
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
platformos-check-0.4.14 lib/platformos_check/checks/template_length.rb
platformos-check-0.4.13 lib/platformos_check/checks/template_length.rb
platformos-check-0.4.12 lib/platformos_check/checks/template_length.rb
platformos-check-0.4.11 lib/platformos_check/checks/template_length.rb
platformos-check-0.4.10 lib/platformos_check/checks/template_length.rb
platformos-check-0.4.9 lib/platformos_check/checks/template_length.rb
platformos-check-0.4.8 lib/platformos_check/checks/template_length.rb
platformos-check-0.4.7 lib/platformos_check/checks/template_length.rb
platformos-check-0.4.6 lib/platformos_check/checks/template_length.rb
platformos-check-0.4.5 lib/platformos_check/checks/template_length.rb
platformos-check-0.4.4 lib/platformos_check/checks/template_length.rb
platformos-check-0.4.3 lib/platformos_check/checks/template_length.rb
platformos-check-0.4.2 lib/platformos_check/checks/template_length.rb
platformos-check-0.4.1 lib/platformos_check/checks/template_length.rb
platformos-check-0.4.0 lib/platformos_check/checks/template_length.rb
platformos-check-0.3.3 lib/platformos_check/checks/template_length.rb
platformos-check-0.3.1 lib/platformos_check/checks/template_length.rb
platformos-check-0.3.0 lib/platformos_check/checks/template_length.rb
platformos-check-0.2.2 lib/platformos_check/checks/template_length.rb
platformos-check-0.2.1 lib/platformos_check/checks/template_length.rb