Skip to content

pre-commit: use repo local - #204

Open
Avasam wants to merge 1 commit into
jaraco:mainfrom
Avasam:pre-commit--use-repo-local
Open

pre-commit: use repo local#204
Avasam wants to merge 1 commit into
jaraco:mainfrom
Avasam:pre-commit--use-repo-local

Conversation

@Avasam

@Avasam Avasam commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Makes pre-commit tooling version desync a thing of the past. Whilst keeping pre-commit as a useful offer and easily installable pre-commit hook

- repo: local means that this can't be used for CI autofixes through pre-commit.ci, but none of your project use it anyway.

And if you did want CI autofixes, I'd recommend pre-commit-lite or autofix.ci anyway, as to keep this version deduplication.

Comment thread .pre-commit-config.yaml Outdated
Comment on lines +40 to +54
# Autofixable return type annotations to help mypy check more code
- id: ruff-ANN2
name: ruff-ANN2
# --exit-zero: only fail when a fix is applied,
# not on leftover non-autofixable violations
entry: >
ruff check
--fix
--unsafe-fixes
--exit-zero
--select=ANN2
--ignore=ANN202
language: system
types_or: [python, pyi]
require_serial: true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I'm not sure I understand the relevance. Can you elaborate?

@Avasam Avasam Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Running pre-commit with this setup runs autofixes for adding simple annotations, without blocking the CI on Ruff for missing return type annotations that can't automatically be added.

But given your comment of

My goal was to eliminate the need to add -> None to every unit test (because unit tests almost never return anything). It feels like noise to me. Automating the addition of that noise reduces the churn burden but not the cognitive burden of ignoring unhelpful annotations.

I understand it's not just about having to add return type annotations manually. So you probably wouldn't want this hook anyway.

That's the relevance to that comment.

Comment thread docs/index.rst
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This looks like editor noise. I prefer files that end in newlines (that's how my editor's configured to save files).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It does still end in newline (github will render image if there's no newline).
This file had 2 newlines !

@Avasam
Avasam force-pushed the pre-commit--use-repo-local branch 2 times, most recently from a0d7383 to 52b8731 Compare July 12, 2026 18:20
@Avasam
Avasam force-pushed the pre-commit--use-repo-local branch from 52b8731 to a89ec19 Compare August 3, 2026 22:17
@Avasam

Avasam commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

I think Claude did an ok job describing what this PR is trying to bring in 96265d3 , of course, those paragraphs should be updated and simplified if this gets merged. (non-local hooks still need a pin, but there's no more duplication)

The two options for PR autofixes would be either:

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.

2 participants