Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ venv/
.mypy_cache/
.tox
test-reports/
.cache

# Sphinx
docs/_build/
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ repos:
rev: v1.47.2
hooks:
- id: typos
- repo: https://github.com/alessio-locatelli/ruff-extra-rules
rev: v0.2.2
hooks:
- id: ruff-extra-rules
- id: ruff-extra-rules-ty
additional_dependencies: [ty]
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,15 @@ known-first-party = ['test']
[tool.ruff.lint.pycodestyle]
max-line-length = 120

[tool.ruff-extra-rules]
fix = true

[tool.ruff-extra-rules.per-file-ignores]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran this locally without the per-file ignores and didn't see any changes; did something previously get flagged, or is this just pre-emptive?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I submitted https://github.com/requests-cache/aiohttp-client-cache/pull/406/commits beforehand, which fixed every finding that didn't touch the public interface. This PR ended up as just the bare pre-commit hook addition on top of that.

The four remaining validate-function-name (TR4) findings are on public library functions, and they're what the per-file-ignores block exists for — the comment right above it explains why: renaming a public function isn't worth breaking the interface now, so it's deferred to the next major release. So no, it isn't pre-emptive.

Removing that block and running prek run -a on this branch reproduces exactly those four:

prek output
Extra Python rule checks (ruff-extra-rules)..............................Failed
- hook id: ruff-extra-rules
- description: Run multiple AST-based checks in a single pass for improved performance. Excludes redundant-type-conversion (TR6) -- see the ruff-extra-rules-ty hook
- exit code: 1

  aiohttp_client_cache/cache_control.py:152:1: TR4: Function 'get_expiration_datetime' should be renamed to 'calculate_expiration_datetime' (aggregates or computes a summary)
  aiohttp_client_cache/cache_control.py:168:1: TR4: Function 'get_cache_directives' should be renamed to 'extract_cache_directives' (extracts/collects data (returns list/dict))
  examples/precache.py:45:1: TR4: Function 'get_page_links' should be renamed to 'extract_page_links' (extracts/collects data (returns list/dict))
  aiohttp_client_cache/backends/base.py:274:1: TR4: Function 'get_urls' should be renamed to 'iter_urls' (generator/iterator)

That's the opposite of what you saw. You already approved and said to go ahead and merge, so I'm not blocking on this — but I'd still like to understand the discrepancy: could you share the exact edit you made to pyproject.toml and confirm you ran prek run -a (not, say, ruff-extra-rules scoped to changed files only)?

@JWCook JWCook Aug 27, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested again: checked out the main branch, removed the per-file-ignores block, and ran prek run -a, but it passed with no warnings. Here's the verbose pre-commit output, although I don't think it contains any useful info:

prek run ruff-extra-rules -a -vv
2026-08-27T21:48:01.130687Z DEBUG prek: 0.2.27
2026-08-27T21:48:01.130720Z DEBUG Args: ["prek", "run", "ruff-extra-rules", "-a", "-vv"]
2026-08-27T21:48:01.132585Z DEBUG Git root: /home/jcook/workspace/aiohttp-client-cache
2026-08-27T21:48:01.132603Z DEBUG Found workspace root at `/home/jcook/workspace/aiohttp-client-cache`
2026-08-27T21:48:01.132645Z DEBUG Performing fresh workspace discovery
2026-08-27T21:48:01.133514Z DEBUG Loading project configuration path=.pre-commit-config.yaml
2026-08-27T21:48:01.135920Z DEBUG Acquired lock resource="store"
2026-08-27T21:48:01.137308Z DEBUG Cloning repo target=/home/jcook/.cache/prek/scratch/.tmpmYscWM repo=https://github.com/alessio-locatelli/ruff-extra-rules@v0.2.2
2026-08-27T21:48:03.621505Z DEBUG Hooks going to run: ["ruff-extra-rules"]
2026-08-27T21:48:03.621686Z DEBUG Found uv in PATH: /home/jcook/.local/bin/uv
2026-08-27T21:48:03.627455Z DEBUG Installing environment hook=ruff-extra-rules target=/home/jcook/.cache/prek/hooks/python-SXrTtyfVtTQFsk5Wh5Gn
2026-08-27T21:48:03.757511Z DEBUG Venv created successfully with no downloads: `/home/jcook/.cache/prek/hooks/python-SXrTtyfVtTQFsk5Wh5Gn`
2026-08-27T21:48:04.670205Z DEBUG Installed hook `ruff-extra-rules` in `/home/jcook/.cache/prek/hooks/python-SXrTtyfVtTQFsk5Wh5Gn`
2026-08-27T21:48:04.672163Z DEBUG All files in the workspace: 79
2026-08-27T21:48:04.674405Z DEBUG Running priority group with priority 10 with concurrency 8: ["ruff-extra-rules"]
Extra Python rule checks (ruff-extra-rules)..............................Passed
- hook id: ruff-extra-rules
- duration: 0.19s

I tested it in CI (logs here) and got the expected warnings, so it must be something with my local dev environment.

# Keeping the library interface (regardless of whether it is a public or
# private function) is more important than renaming a function for a negligible
# clarity improvement. However, this can be done in the next major release.
"aiohttp_client_cache/*" = ["validate-function-name"]
"examples/*" = ["validate-function-name"]

[tool.typos]
files.extend-exclude = ["CONTRIBUTORS.md"]
Loading