-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use pre-commit for python files #59522
base: master
Are you sure you want to change the base?
Conversation
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
@troopa81 @nyalldawson @elpaso @m-kuhn any feedback welcome! |
|
||
ci: | ||
autofix_prs: true | ||
autoupdate_schedule: quarterly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would that mean that if you're the first to push a PR after a hook update (let's say black rules for instance), you're gonna push a lot of modified files which are not related to your PR? Or is there an auto PR/commit pushed automatically on the repo on update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
autoupdate is to update the tools used, so nothing related to the source code.
if there's a hook update, there's not that many changes brought. And in a PR, IIRC only the modified files are tested.
I am a big fan of The main question here for me is, how this coexists with existing pre-commit hooks, in terms of local development configuration? Does one call the other ( |
Can you create a .git-blame-ignore-revs file and exclude the "run-precommit" commit from it? See https://gist.github.com/kateinoigakukun/b0bc920e587851bfffa98b9e279175f2 And I'm hugely in favour of this move! |
good point, I've added prepare_commit to the pre-commit hook: f24de2e
good catch. I've added the file. I suppose we can wait to merge to update that file with the proper commit (in case it's rebased)? |
This comment was marked as outdated.
This comment was marked as outdated.
In case there is no further discussions, I would merge it in a couple of days. I would assume the general acceptance is fine since there were no objections in @elpaso's QEP qgis/QGIS-Enhancement-Proposals#265 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No objections so far but positive feedback. I'm in favor of merging this.
This enables pre-commit hook for Python files and disable Python formatting from prepare-commit.sh
I've only added: pyupgrade, black and isort without specific config for the sake of simplicity/clarity. See config for details.
I've also enabled auto-fix for PRs (will be effective when we activate pre-commit.ci).
We've recently succeeded at using clang-format on a sipified project (see kadas-albireo/kadas-albireo2#175). So this is a first small step before starting to touch at cpp code.