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

Aberta
#4,182 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 2 dias

@anth-volk já está trabalhando nisso.

Desde 4/11/2026.

  • #4183 de @anth-volk — aberto

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
20/100
Tipo de issue
Funcionalidade
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
python
Domínio
testing-qa, tooling

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Python
Estrelas
18
Forks
33
Merge médio
2d 21h
PRs com merge (30d)
93

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de PolicyEngine/policyengine-api

Todas as issues de PolicyEngine/policyengine-api

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.