Skip to content

Update pre-commit hooks and adapt to ruff 0.16 - #3993

Merged
mbertrand merged 5 commits into
mainfrom
mb/ruff-0.16
Sep 29, 2026
Merged

mbertrand merged 5 commits into
mainfrom
mb/ruff-0.16

Conversation

@mbertrand

Copy link
Copy Markdown
Member

What are the relevant tickets?

Replaces #3649 (pre-commit.ci autoupdate), which fails the ruff hook.

Description (What does it do?)

  • Includes the [pre-commit.ci] pre-commit autoupdate #3649 hook bumps: ruff 0.15.21 → 0.16.8, shfmt, shellcheck, zizmor, plus pre-commit.ci's autofixes (Python formatting in docs code blocks, one # noqa ruff no longer needs)
  • Ruff 0.16 made CPY001 (769 hits) and PLR0917 (37 hits) official. Before, they were preview-only and never ran. Both are added to lint.ignore.
  • Fixes the new ISC004 (3) and RUF036 (1) hits: wraps joined strings in parentheses and moves None to the end of one type hint. Behaviour is unchanged.

How can this be tested?

  • The pre-commit.ci check passes
  • Locally: uvx ruff@0.16.8 check . --extend-ignore=D1 finds nothing

Additional Context

Once this merges, #3649 can be closed. pre-commit.ci will reopen its own PR at the next autoupdate.

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings September 25, 2026 17:30
@mbertrand
mbertrand requested a review from a team as a code owner September 25, 2026 17:30
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

OpenAPI Changes

No changes detected

View full changelog

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The hook versions are valid, and the compatibility edits preserve existing behavior.

Review effort: Balanced
Findings: None

What changed in this PR

Updates pre-commit hooks and applies formatting/configuration changes required by Ruff 0.16.

Changes:

  • Bumps shfmt, Ruff, ShellCheck, and zizmor hooks.
  • Ignores newly stabilized Ruff rules and resolves new formatting violations.
  • Applies Ruff formatting to Python documentation examples.
File Description
.pre-commit-config.yaml Updates hook versions.
pyproject.toml Ignores CPY001 and PLR0917.
learning_resources/​utils.py Reorders a union annotation.
learning_resources/​utils_test.py Parenthesizes joined strings.
learning_resources/​migrations/​0120_view_event_uuid_unique_index.py Parenthesizes joined SQL strings.
learning_resources/​etl/​utils.py Removes an obsolete noqa.
learning_resources/​data/​README-topics.md Formats the Python example.
docs/​how-to/​articles-to-news.md Formats Python examples.
docs/​articles-cdn-purge.md Formats Python examples.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The hook versions are valid, and the Ruff compatibility changes are targeted and behavior-preserving.

Review effort: Balanced
Findings: None

@umar8hassan umar8hassan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks Good 👍

Comment thread pyproject.toml Outdated
Comment thread .pre-commit-config.yaml
@shanbady
shanbady self-requested a review September 28, 2026 13:43
mbertrand added a commit that referenced this pull request Sep 29, 2026
Address review feedback on #3993.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pre-commit-ci Bot and others added 5 commits September 29, 2026 10:49
updates:
- [github.com/scop/pre-commit-shfmt: v3.13.1-1 → v3.14.1-1](scop/pre-commit-shfmt@v3.13.1-1...v3.14.1-1)
- [github.com/astral-sh/ruff-pre-commit: v0.15.21 → v0.16.8](astral-sh/ruff-pre-commit@v0.15.21...v0.16.8)
- [github.com/shellcheck-py/shellcheck-py: v0.11.0.1 → v0.11.0.1-1](shellcheck-py/shellcheck-py@v0.11.0.1...v0.11.0.1-1)
- [github.com/zizmorcore/zizmor-pre-commit: v1.29.0 → v1.30.1](zizmorcore/zizmor-pre-commit@v1.29.0...v1.30.1)
Ruff 0.16 stabilized CPY001 and PLR0917, which were preview-only (and so
inactive) under 0.15. Ignore both, and fix the new ISC004/RUF036 hits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test functions take pytest fixtures positionally, so ignore PLR0917 in
test files. Keep it on for app code and extend the existing PLR0913
noqa comments to cover it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Address review feedback on #3993.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mbertrand
mbertrand merged commit 2948b51 into main Sep 29, 2026
14 checks passed
@mbertrand
mbertrand deleted the mb/ruff-0.16 branch September 29, 2026 15:15
This was referenced Sep 29, 2026
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.

4 participants