Skip to content

chore: fix findings from latest ruff, add lint CI - #242

Open
Solmath wants to merge 4 commits into
noahhusby:mainfrom
Solmath:chore/compatibility-with-latest-ruff
Open

chore: fix findings from latest ruff, add lint CI#242
Solmath wants to merge 4 commits into
noahhusby:mainfrom
Solmath:chore/compatibility-with-latest-ruff

Conversation

@Solmath

@Solmath Solmath commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Why this PR

There is currently no lint step in CI, so nothing checks whether a ruff version bump changes what gets flagged. I forgot to run poetry sync after ruff was bumped to 0.16.2 in pyproject.toml, so my local venv was still on an older version (0.14.2) and had never actually run the pinned one. Once I synced, the new default rule set turned up a batch of findings across aiostreammagic/ and examples/ that nobody had seen before, because pre-commit only ever ran against whatever ruff happened to be installed in each contributor's venv.

This PR:

  • Fixes all of it: the autofixable findings, plus the 6 that needed manual changes (aware datetimes, a justified blind except, Self/TracebackType typing on __aenter__/__aexit__, and a dict.keys() cleanup) - see the commit messages for details.
  • Adds .github/workflows/lint.yml so a ruff/mypy regression like this shows up on the PR that introduces it (including Dependabot's own version-bump PRs), instead of staying invisible until someone happens to sync their venv.

Suggestion for a follow-up

Right now .pre-commit-config.yaml runs ruff as a repo: local hook (entry: poetry run ruff check --fix), so its version depends on whatever is installed in each contributor's venv rather than a pinned, isolated environment. That is what let this go unnoticed for so long. Switching to the official ruff-pre-commit hook with a pinned rev would fix that. I would keep mypy as a local hook, since it needs the project's own dependencies installed to resolve types. Happy to open that as a separate PR if useful.

…nd manual fixes

* refactoring imports
* replacing optional
* pass tz to `datetime.now()`
* add justification for blind exception
* update types in '__aenter__` and `__aexit__`
@Solmath
Solmath marked this pull request as ready for review August 15, 2026 15:16
@Solmath
Solmath requested a review from noahhusby as a code owner August 15, 2026 15:16
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