Repository navigation
fix: add stricter lint checks and fix the defects they found - #1401
Merged
Merged
Conversation
JuanLeee
force-pushed
the
chore/lint-config
branch
from
November 30, 2026 09:45
6e68521 to
455020c
Compare
karenc-bq
reviewed
Nov 30, 2026
karenc-bq
approved these changes
Nov 30, 2026
JuanLeee
force-pushed
the
chore/lint-config
branch
from
November 30, 2026 18:19
455020c to
49bf412
Compare
Checks added: - mypy: strict_equality, warn_unused_ignores, ignore-without-code and unused-awaitable. - ruff, run alongside flake8: B, ASYNC, RUF006, and TID251 to ban psycopg, mysql and aiomysql imports outside the driver dialects. - import-linter: only the aio tree and the async SQLAlchemy dialects import aio, and the plugin service and wrapper modules do not import the Django or SQLAlchemy integrations. CI runs ruff check . and lint-imports after isort. ruff and import-linter are new dev dependencies; import-linter is pinned to 2.15, the last release that supports Python 3.10. Fixes: - The sync is_static_host_list_provider() compared the provider instance with a class, so it always returned False and the two branches that called it never ran. The method and both branches are removed, so stale DNS and read/write splitting behave as they do on main. - The blue/green status provider bound green_host late in a loop, so every IAM success handler registered the last green host. - The aio topology monitor dropped the tasks it scheduled, so they could be garbage-collected before they finished. - HostResponseTimeMonitor kept its closed connection after stopping, and its tests compared values without asserting them. Also removes 79 type: ignore comments that no longer hid anything, and fixes smaller issues the checks flagged, mostly in tests.
JuanLeee
force-pushed
the
chore/lint-config
branch
from
November 30, 2026 18:25
49bf412 to
ccb181f
Compare
JuanLeee
added a commit
that referenced
this pull request
Dec 2, 2026
Main's #1401 turned on mypy's warn_unused_ignores and strict_equality and ruff's B905, which the kms code predates. - Drop 18 type: ignore comments in unannotated test functions, whose bodies mypy does not check. - Pass strict=False to 13 zip() calls, as #1401 did, so behaviour stays the same. - Cast the driver iterator to object in AwsWrapperCursor.__next__: a driver cursor can be its own iterator, which the Cursor type does not show.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds stricter static checks to CI and fixes the defects they found on main.
Checks added
strict_equality,warn_unused_ignores,ignore-without-codeandunused-awaitable.B,ASYNC,RUF006, andTID251to banpsycopg,mysqlandaiomysqlimports outside the driver dialects.aiotree and the async SQLAlchemy dialects importaio, and the plugin service and wrapper modules do not import the Django or SQLAlchemy integrations.CI runs
ruff check .andlint-importsafter isort. ruff and import-linter are new dev dependencies; import-linter is pinned to 2.15, the last release that supports Python 3.10.Fixes
is_static_host_list_provider()compared the provider instance with a class, so it always returned False and the two branches that called it never ran. The method and both branches are removed, so stale DNS and read/write splitting behave as they do on main.green_hostlate in a loop, so every IAM success handler registered the last green host.HostResponseTimeMonitorkept its closed connection after stopping, and its tests compared values without asserting them.The PR also removes 79
# type: ignorecomments that no longer hid anything, and fixes smaller issues the checks flagged, mostly in tests.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.