Check that every noqa and type: ignore comment names a code and gives a reason

Abierto
#4,182 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

@anth-volk ya está trabajando en esto.

Desde el 4/11/2026.

  • #4183 de @anth-volk — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
20/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
python

Línea de trabajo

Read docs/engineering/skills/rules-registry.md and step 2.7 of the code-quality plan, then inspect rules/registry.toml and the existing rules under rules/. Build the suppression check around the listed noqa and type: ignore forms, with current violations recorded in a shrinking baseline under rules/baselines/. Done means the ratcheted rule is registered and detects missing codes or reasons; pull request #4183 is already open.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

What

Add a quality guard that fails on any inline suppression comment that doesn't name what it suppresses and say why:

  • a noqa comment, line-level or file-level (# ruff: noqa, # flake8: noqa), must list its ruff codes;
  • a type: ignore comment must list its mypy error codes in brackets;
  • each must be followed by a reason, as # noqa: CODE # reason or # type: ignore[code] # reason.

Today's comments without a reason go in a baseline file under rules/baselines/, which can only shrink.

Why

docs/engineering/skills/rules-registry.md already says every suppression gives its reason after the code, and the doc-only rule api.process.agents-suppress-as-last-resort asks agents to suppress only as a last resort. Nothing checks either. Ruff's PGH003 and PGH004 reject a suppression without a code, but nothing rejects one without a reason: 21 noqa comments, one file-level # ruff: noqa: E402 and all 10 type: ignore comments have none today.

This is the suppression check in step 2.7 of the code-quality plan, registered in rules/registry.toml as a ratcheted rule beside api.process.agents-suppress-as-last-resort.

Lenguaje dominante
Python
Estrellas
18
Forks
33
Merge medio
2 d 21 h
PR fusionados (30 d)
93

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PolicyEngine/policyengine-api

Todos los issues de PolicyEngine/policyengine-api

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.