Class: PlatformosCheck::MissingTemplate
- Inherits:
-
LiquidCheck
- Object
- Check
- LiquidCheck
- PlatformosCheck::MissingTemplate
- Defined in:
- lib/platformos_check/checks/missing_template.rb
Overview
Reports missing include/render/section liquid file
Defined Under Namespace
Classes: MissingFileCorrection
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
-
#initialize(ignore_missing: []) ⇒ MissingTemplate
constructor
A new instance of MissingTemplate.
- #on_background(node) ⇒ Object
- #on_function(node) ⇒ Object
- #on_graphql(node) ⇒ Object
- #on_include(node) ⇒ Object
- #on_render(node) ⇒ Object
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(ignore_missing: []) ⇒ MissingTemplate
Returns a new instance of MissingTemplate.
38 39 40 |
# File 'lib/platformos_check/checks/missing_template.rb', line 38 def initialize(ignore_missing: []) @ignore_missing = ignore_missing end |
Instance Method Details
#on_background(node) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/platformos_check/checks/missing_template.rb', line 56 def on_background(node) partial = node.value.partial_name return unless partial.is_a?(String) add_missing_template_offense(partial, file_type: PartialFile, node:) end |
#on_function(node) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/platformos_check/checks/missing_template.rb', line 63 def on_function(node) partial = node.value.from return unless partial.is_a?(String) add_missing_template_offense(partial, file_type: PartialFile, node:) end |
#on_graphql(node) ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'lib/platformos_check/checks/missing_template.rb', line 70 def on_graphql(node) return if node.value.inline_query path = node.value.partial_name return unless path.is_a?(String) add_missing_template_offense(path, file_type: GraphqlFile, node:) end |
#on_include(node) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/platformos_check/checks/missing_template.rb', line 42 def on_include(node) partial = node.value.template_name_expr return unless partial.is_a?(String) add_missing_template_offense(partial, file_type: PartialFile, node:) end |
#on_render(node) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/platformos_check/checks/missing_template.rb', line 49 def on_render(node) partial = node.value.template_name_expr return unless partial.is_a?(String) add_missing_template_offense(partial, file_type: PartialFile, node:) end |