Skip to content

Python · maintainability

no-file-level-suppression

python:no-file-level-suppression

Unscoped file-level suppressions disable a checker for the entire file, including diagnostics added later.

Code
SARJ038
Default
error
Fix
none
Languages
python

Why

Blanket suppressions also hide diagnostics introduced by future tool upgrades.

Fix

Fix the findings or limit the directive to the specific diagnostic codes being suppressed.

Before / after

Executed by this rule’s unit tests.

Before

Ruff disabled for the file

service.py · focus
# ruff: noqa
import os

After

Ruff suppression names its code

service.py · focus
# ruff: noqa: E501
import os

Limits

  • Only Ruff, mypy-compatible `type: ignore`, and Pyright file-level directives are analyzed.
  • Trailing per-line suppressions and directives with an explicit code list are allowed.