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
  • bros
  • cohere_asr
  • emu3
  • exaone4_5
  • gemma4
  • glm46v
  • glm_image
  • glmga
  • granite_speech
  • higgs_audio_v2
  • inkling
  • kyutai_speech_to_text
  • lasr
  • minimax_m3_vl
  • moonshine_streaming
  • nemotron3_5_asr
  • nemotron_asr_streaming
  • nougat
  • paddleocr_vl
  • pe_audio
  • pe_audio_video
  • pe_video
  • pi0
  • pp_formulanet
  • rf_detr
  • sam2
  • sam2_video
  • sam3_tracker
  • sam3_tracker_video
  • sam3_video
  • siglip
  • siglip2
  • tvp
  • video_llava
  • vilt
  • vjepa2
  • voxtral
  • voxtral_realtime
  • x_clip