PartialCallArguments
PartialCallArguments
Severity: error | Type: LiquidHtml
This check ensures that all required arguments are passed when calling {% render %} or {% function %} tags, and that no unknown arguments are passed at any call site, {% include %} included.
This check only runs when the called partial has NO {% doc %} tag. With no declared contract to read, it infers one: it scans the partial body for undefined variables and treats them as the parameter list. When a partial does declare its parameters, the checks that read that declaration take over instead — MissingRenderPartialArguments for missing required arguments and UnrecognizedRenderPartialArguments for unknown ones. Exactly one check reports each problem, so adding a {% doc %} tag to a partial changes which check names the offense, not whether it is found.
A missing argument is only reported for {% render %} and {% function %}, which run the partial in a fresh scope. {% include %} runs it in the caller's scope, so a variable the partial reads and the call does not pass resolves from the caller and nothing is broken — that is a warning about explicitness from ImplicitIncludeArguments, not an error from this check. An unknown argument is reported at an {% include %} site just the same: passing something the partial never reads is a mistake whichever tag you used.
How the parameter list is inferred:
- A variable the partial reads directly is a required parameter.
- A variable the partial reads through the
| defaultfilter is optional — the partial handles its own absence. This applies both to the defaulted variable and to the fallback value: in{% assign profile = profile | default: params.profile %}bothprofileandparamsare optional, because a fallback is only read when the value it stands in for is missing. contextis in scope inside every partial, so it is never inferred as a parameter. Passing it as an argument is redundant but not reported as unknown.- Objects the platform supplies only to a particular kind of file are not in scope in a partial, and a partial reading one is reading a parameter somebody has to pass.
content_for_layoutexists only in layouts;dataandresponseonly in api_calls. A partial using{{ data }}therefore requires adataargument. Reached by{% include %}from a file that does have the object in scope, the same read is a warning rather than an error, since the value is inherited.
Note: This check was previously named
MetadataParamsCheck. The old name is still accepted as an alias in.platformos-check.yml, but new configurations should usePartialCallArguments.
Examples
✗ Incorrect Code Example (Avoid using this):
{% comment %}app/views/partials/greeting.liquid{% endcomment %}
<h1>Hello, {{ name }}!</h1>
{% comment %}Calling site — 'name' is required but not passed{% endcomment %}
{% render 'greeting' %}
✓ Correct Code Example (Use this instead):
{% render 'greeting', name: current_user.name %}
Configuration
The default configuration for this check:
PartialCallArguments:
enabled: true
severity: error
Disabling This Check
This check can be disabled for partials where dynamic variable passing is intentional and cannot be statically analyzed.