Class: ThemeCheck::DeprecatedFilter
- Inherits:
-
LiquidCheck
- Object
- Check
- LiquidCheck
- ThemeCheck::DeprecatedFilter
- Defined in:
- lib/theme_check/checks/deprecated_filter.rb
Constant Summary
Constants inherited from LiquidCheck
LiquidCheck::ATTR, LiquidCheck::HTML_ATTRIBUTE, LiquidCheck::HTML_ATTRIBUTES, LiquidCheck::QUOTED_LIQUID_ATTRIBUTE, LiquidCheck::START_OR_END_QUOTE, LiquidCheck::TAG, LiquidCheck::VARIABLE
Constants inherited from Check
Check::CATEGORIES, Check::SEVERITIES
Instance Attribute Summary
Attributes inherited from Check
Instance Method Summary collapse
Methods inherited from LiquidCheck
Methods included from ChecksTracking
Methods included from ParsingHelpers
Methods inherited from Check
all, can_disable, #can_disable?, categories, #categories, category, #code_name, #doc, doc, docs_url, #ignore!, #ignored?, #severity, severity, #to_s, #unignore!
Methods included from JsonHelpers
Instance Method Details
#on_variable(node) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/theme_check/checks/deprecated_filter.rb', line 8 def on_variable(node) used_filters = node.value.filters.map { |name, *_rest| name } used_filters.each do |filter| alternatives = ShopifyLiquid::DeprecatedFilter.alternatives(filter) next unless alternatives alternatives = alternatives.map { |alt| "`#{alt}`" } add_offense( "Deprecated filter `#{filter}`, consider using an alternative: #{alternatives.join(', ')}", node: node, ) end end |