TRF038
Every modeling-family source file needs a matching test file under tests/models/.
| Default | Enabled |
| Scope | All models |
| Source | mlinter/trf038.py |
| Show in terminal | mlinter --rule TRF038 |
What it does
For each modeling_*.py, processing_*.py, image_processing_*.py, video_processing_*.py and feature_extraction_*.py file, checks that a corresponding tests/models/<model>/test_*.py file exists (e.g. modeling_acme.py -> tests/models/acme/test_modeling_acme.py). configuration_*.py is exempt since config classes are conventionally covered by ConfigTester inside the companion test_modeling_*.py file. modular_*.py files are handled separately: since a single modular file can define modeling, processing, image/video-processor and config classes together, the classes it defines are classified by name suffix (XxxModel/XxxPreTrainedModel/XxxForCausalLM -> modeling, XxxImageProcessor(Fast) -> image processing, XxxProcessor -> processing, XxxVideoProcessor -> video processing, XxxFeatureExtractor -> feature extraction, XxxConfig -> skipped), and one violation is reported per missing test file, not just one per source file. There is no # trf-ignore: TRF038 support for this rule: use allowlist_models if a model genuinely cannot ship a test yet, so the exemption is visible in review.
Why is this bad?
A source file with no test file has no regression coverage: a broken forward pass, a bad conversion mapping, or a processor bug can land and stay broken indefinitely. Every model can be exercised with a dummy config and randomly initialized weights, so ‘nothing to test’ is not a valid reason to skip this.
Example
src/transformers/models/acme/modeling_acme.py
+tests/models/acme/test_modeling_acme.py
Suppressing this rule
Add a # trf-ignore: TRF038 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
39 models are exempt from TRF038 in mlinter/rules.toml, because they predate the convention and cannot be changed without breaking backward compatibility.
Show the 39 allowlisted models
broscohere_asremu3exaone4_5gemma4glm46vglm_imageglmgagranite_speechhiggs_audio_v2inklingkyutai_speech_to_textlasrminimax_m3_vlmoonshine_streamingnemotron3_5_asrnemotron_asr_streamingnougatpaddleocr_vlpe_audiope_audio_videope_videopi0pp_formulanetrf_detrsam2sam2_videosam3_trackersam3_tracker_videosam3_videosiglipsiglip2tvpvideo_llavaviltvjepa2voxtralvoxtral_realtimex_clip
