FilterArity
FilterArity
Severity: error | Type: LiquidHtml
This check reports a filter that exists but is called with the wrong number of arguments.
platformOS raises Liquid::ArgumentError when it happens, so the page returns a 500 rather than rendering with a missing value. It is the same failure class as UnknownFilter, and it is reported for the same reason.
The piped value counts as one argument. In {{ a | hash_merge: b }}, the filter receives two: a and b.
Examples
✗ Incorrect Code Example (Avoid using this):
{{ null | hash_merge }}
hash_merge accepts exactly two arguments and is given one — the piped value alone. At render time this raises Liquid::ArgumentError: wrong number of arguments (given 1, expected 2).
✓ Correct Code Example (Use this instead):
{% assign a = {"x": 1} %}
{% assign b = {"y": 2} %}
{{ a | hash_merge: b }}
What is not reported
Arity comes from the published filter documentation. A filter for which no arity is documented produces nothing — so a gap in the documentation cannot make this check refuse working code.
Configuration
The default configuration for this check:
FilterArity:
enabled: true
severity: error
Disabling This Check
Disabling this check is not recommended. Every finding it produces is a page that returns a 500 when the template renders.