TRF028

Model files must carry a complete license header.

   
Default Enabled
Scope Models added on or after 2026-06-20
Source mlinter/trf028.py
Show in terminal mlinter --rule TRF028

What it does

Checks the first 25 lines of modeling_*.py, modular_*.py, configuration_*.py, processing_*.py, image_processing_*.py and video_processing_*.py for a Licensed under the <name> License line followed by every clause of the standard warranty paragraph, from You may obtain a copy of the License at through limitations under the License.. Lines are flattened and lowercased first, so wrapping and comment style do not matter. The license name and copyright line are not checked: they vary per model.

Why is this bad?

A file shipped without the header leaves its provenance ambiguous, and adding it later means touching an already-released file. Matching only Apache License would let through the defects that actually occur: a paragraph truncated mid-way, a header that stops after the URL, or one mangled by a bad search-and-replace.

Example

+# Copyright 2026 The HuggingFace Team. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# ...
 """PyTorch Acme model."""

Suppressing this rule

Add a # trf-ignore: TRF028 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.