Class: ThemeCheck::AppBlockValidTags

Inherits:
LiquidCheck show all
Defined in:
lib/theme_check/checks/app_block_valid_tags.rb

Overview

Reports errors when invalid tags are used in a Theme App Extension block

Constant Summary collapse

OFFENSE_MSG =
"Theme app extension blocks cannot contain %s tags"

Constants inherited from Check

Check::CATEGORIES, Check::SEVERITIES, Check::SEVERITY_VALUES

Instance Attribute Summary

Attributes inherited from Check

#ignored_patterns, #offenses, #options, #theme

Instance Method Summary collapse

Methods included from ChecksTracking

#inherited

Methods included from ParsingHelpers

#outside_of_strings

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_theme?

Methods included from JsonHelpers

#format_json_parse_error, #pretty_json

Instance Method Details

#on_include(node) ⇒ Object



24
25
26
# File 'lib/theme_check/checks/app_block_valid_tags.rb', line 24

def on_include(node)
  add_offense(OFFENSE_MSG % 'include', node: node)
end

#on_javascript(node) ⇒ Object



16
17
18
# File 'lib/theme_check/checks/app_block_valid_tags.rb', line 16

def on_javascript(node)
  add_offense(OFFENSE_MSG % 'javascript', node: node)
end

#on_layout(node) ⇒ Object



28
29
30
# File 'lib/theme_check/checks/app_block_valid_tags.rb', line 28

def on_layout(node)
  add_offense(OFFENSE_MSG % 'layout', node: node)
end

#on_section(node) ⇒ Object



32
33
34
# File 'lib/theme_check/checks/app_block_valid_tags.rb', line 32

def on_section(node)
  add_offense(OFFENSE_MSG % 'section', node: node)
end

#on_stylesheet(node) ⇒ Object



20
21
22
# File 'lib/theme_check/checks/app_block_valid_tags.rb', line 20

def on_stylesheet(node)
  add_offense(OFFENSE_MSG % 'stylesheet', node: node)
end