Class: ThemeCheck::ValidSchema

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

Constant Summary

Constants inherited from Check

Check::CATEGORIES, Check::SEVERITIES

Instance Attribute Summary

Attributes inherited from Check

#offenses, #options, #theme

Instance Method Summary collapse

Methods inherited from LiquidCheck

#add_offense

Methods included from ChecksTracking

#inherited

Methods included from ParsingHelpers

#outside_of_strings

Methods inherited from Check

all, can_disable, #can_disable?, category, #category, #code_name, doc, #doc, #ignore!, #ignored?, #severity, severity, #to_s, #unignore!

Methods included from JsonHelpers

#format_json_parse_error

Instance Method Details

#on_schema(node) ⇒ Object



7
8
9
10
11
# File 'lib/theme_check/checks/valid_schema.rb', line 7

def on_schema(node)
  JSON.parse(node.value.nodelist.join)
rescue JSON::ParserError => e
  add_offense(format_json_parse_error(e), node: node)
end