Skip to content

chore: name error codes in type: ignore and noqa comments - #1890

Merged
spydon merged 3 commits into
mainfrom
chore/type-ignore-codes
Nov 2, 2026
Merged

spydon merged 3 commits into
mainfrom
chore/type-ignore-codes

Conversation

@spydon

@spydon spydon commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Stacked on #1889. Review that first; this PR only contains the last commit.

Why

A bare # type: ignore silences every mypy error on its line, including new ones introduced later. A bare # noqa does the same for Ruff. With 47 bare type: ignore comments and 11 bare noqa comments, a new bug on one of those lines would go unnoticed.

What changed

  • Each bare # type: ignore now names the codes mypy actually reports on that line, for example # type: ignore[method-assign]. I found them by removing each comment, running mypy and putting back exactly the codes it reported. All of them were still needed, and none were removed.
  • The bare # noqa comments are gone, replaced by real fixes:
    • The supabase_auth/__init__.py re-exports use X as X, the same as realtime since chore: unify ruff config and enable more lint rules #1887.
    • AsyncGoTrueBaseAPI._request uses raise handle_exception(e) from e, which B904 asks for. This keeps the original HTTP error as __cause__ instead of __context__.
  • Enabled PGH003 and PGH004 in the root Ruff config, so new bare type: ignore and noqa comments fail CI. Combined with warn_unused_ignores, which auth, postgrest, realtime and storage already enable, these comments now have to stay accurate.

Verification

  • Ruff passes on all of src/, and mypy passes for all six packages.
  • The _sync trees were regenerated with build-sync.

@spydon
spydon requested a review from o-santi as a code owner October 30, 2026 17:09
Base automatically changed from chore/pep585-annotations to main October 30, 2026 19:40
@spydon
spydon merged commit 51729d2 into main Nov 2, 2026
85 of 86 checks passed
@spydon
spydon deleted the chore/type-ignore-codes branch November 2, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant