Sha256: 3655b23898656551c3d647df403e8689a33f6aa9dc4cce3bcf4ef24b9000fa09

Contents?: true

Size: 440 Bytes

Versions: 5

Compression:

Stored size: 440 Bytes

Contents

# frozen_string_literal: true
module ThemeCheck
  class TemplateLength < LiquidCheck
    severity :suggestion
    category :liquid

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

    def on_document(node)
      lines = node.template.source.count("\n")
      if lines > @max_length
        add_offense("Template has too many lines [#{lines}/#{@max_length}]", template: node.template)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
theme-check-0.2.2 lib/theme_check/checks/template_length.rb
theme-check-0.2.0 lib/theme_check/checks/template_length.rb
theme-check-0.1.2 lib/theme_check/checks/template_length.rb
theme-check-0.1.1 lib/theme_check/checks/template_length.rb
theme-check-0.1.0 lib/theme_check/checks/template_length.rb