A Pydantic field is marked SkipValidation and also given constraints, which are then never checked
What it finds
SkipValidation turns validation of the field off entirely, so constraints such as Field(gt=0) or max_length placed next to it in Annotated[...] are silently ignored. Either the constraints or the marker is a mistake.
From the rule's source, unchecked_field_constraints.rs.
from typing import Annotatedfrom pydantic import BaseModel, Field, SkipValidation class M(BaseModel): a: Annotated[int, SkipValidation, Field(gt=0)]tx0 reports: SkipValidation turns off the constraints b: Annotated[int, SkipValidation, Field(description="x")] c: Annotated[int, Field(gt=0)] Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/python:unchecked-field-constraints" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:unchecked-field-constraints] reason="..."tx0 explain tx0/python:unchecked-field-constraints shows the same in the terminal. Found a false positive? Report it.