Class: PlatformosCheck::UnknownFilter
- Inherits:
-
LiquidCheck
- Object
- Check
- LiquidCheck
- PlatformosCheck::UnknownFilter
- Defined in:
- lib/platformos_check/checks/unknown_filter.rb
Overview
Unwanted:
x | some_unknown_filter }
Wanted:
x | upcase }
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
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
Instance Method Details
#on_variable(node) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/platformos_check/checks/unknown_filter.rb', line 18 def on_variable(node) used_filters = node.filters.map { |name, *_rest| name } undefined_filters = used_filters - PlatformosLiquid::Filter.labels - PlatformosLiquid::Filter.aliases undefined_filters.each do |undefined_filter| add_offense("Undefined filter `#{undefined_filter}`", node:) end end |