Class: PlatformosCheck::TemplateLength
- Inherits:
-
LiquidCheck
- Object
- Check
- LiquidCheck
- PlatformosCheck::TemplateLength
- Defined in:
- lib/platformos_check/checks/template_length.rb
Constant Summary
Constants inherited from Check
Check::CATEGORIES, Check::SEVERITIES, Check::SEVERITY_VALUES
Instance Attribute Summary
Attributes inherited from Check
#ignored_patterns, #offenses, #options, #platformos_app
Instance Method Summary collapse
- #after_document(node) ⇒ Object
-
#initialize(max_length: 600) ⇒ TemplateLength
constructor
A new instance of TemplateLength.
Methods included from ChecksTracking
Methods included from ParsingHelpers
Methods inherited from Check
#==, #add_offense, all, can_disable, #can_disable?, categories, #categories, category, #code_name, doc, #doc, docs_url, #ignore!, #ignored?, #severity, severity, #severity=, #severity_value, severity_value, single_file, #single_file?, #to_s, #whole_platformos_app?
Methods included from JsonHelpers
#format_json_parse_error, #pretty_json
Constructor Details
#initialize(max_length: 600) ⇒ TemplateLength
Returns a new instance of TemplateLength.
9 10 11 |
# File 'lib/platformos_check/checks/template_length.rb', line 9 def initialize(max_length: 600) @max_length = max_length end |
Instance Method Details
#after_document(node) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/platformos_check/checks/template_length.rb', line 13 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 |