TRF006

Cache arguments declared in a forward signature should be used in its body.

   
Default Enabled
Scope All models
Source mlinter/trf006.py
Show in terminal mlinter --rule TRF006

What it does

Checks that cache arguments in a forward signature are used in the body.

Why is this bad?

An unused cache argument suggests 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_clip
  • evolla
  • idefics2
  • llama4