TRF006
forward with cache arguments should reference cache control/state variables consistently.
| Default | Enabled |
| Scope | All models |
| Source | mlinter/trf006.py |
| Show in terminal | mlinter --rule TRF006 |
What it does
Checks forward signatures that expose cache arguments for usage of those arguments in method body.
Why is this bad?
Unused cache arguments can indicate incomplete caching support and inconsistent API behavior.
Example
def forward(self, x, past_key_values=None, use_cache=False):
+ if use_cache:
+ ...
return x
Suppressing this rule
Add a # trf-ignore: TRF006 comment on the flagged line or the line directly above it. See Suppressing rules for whole-file directives and when a suppression is the wrong answer.
Allowlisted models
4 models are exempt from TRF006 in mlinter/rules.toml, because they predate the convention and cannot be changed without breaking backward compatibility.
Show the 4 allowlisted models
chinese_clipevollaidefics2llama4
