Skip to content
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 to automate installation and management of all pre-commit hooks #265

Open
elpaso opened this issue Apr 5, 2023 · 6 comments

Comments

@elpaso
Copy link

elpaso commented Apr 5, 2023

QGIS Enhancement: Use pre-commit to automate the installation and management of all pre-commit hooks

Date 2023/04/05

Author Alessandro Pasotti (@elpaso)

Contact elpaso at itopen dot it

maintainer @elpaso

Version QGIS 3.34

Summary

QGIS is currently using a set of pre-commit hooks to run scripts that manage the source code (format, checks etc.) before each commit.

Hooks must be installed manually which is not ideal.

Proposed Solution

Switch to https://pre-commit.com/ to manage our pre-commit hooks, this framework provides automated installation and configuration of the hooks, it has also a set of pre-defined hooks ready to use https://pre-commit.com/hooks.html

To install the hooks a user will just run pre-commit install to install pre-commit into the git hooks. pre-commit will now run on every commit. Every time you clone a project using pre-commit running pre-commit install should always be the first thing you do.

GDAL is successfully using this system.

Affected Files

Current pre-hook scripts.

Performance Implications

None

Backwards Compatibility

None

Votes

(required)

@Guts
Copy link

Guts commented Apr 5, 2023

Good idea, I though it's was already used!

And use pre-commit.ci to run hooks on PR?

@elpaso
Copy link
Author

elpaso commented Apr 5, 2023

And use pre-commit.ci to run hooks on PR?

Definitely: I'd need to check if that works with our hooks but it looks promising!

@m-kuhn
Copy link
Member

m-kuhn commented Apr 6, 2023

We've had very good experiences with pre-commit (still happily using https://github.com/pre-commit/action)

@anitagraser
Copy link
Member

Thank you for submitting your proposal to the 2024 QGIS Grant Programme. The 2 week discussion period starts today. At the end of the discussion, the proposal author has to provide a 3-line pitch of their proposal for the voter information material. (For an example from last year check qgis/PSC#58 (comment))

@anitagraser
Copy link
Member

@elpaso Does your grant application also include #264 ? I'm asking since the proposal lists 264 but only 265 is tagged with Grant-2024.

@elpaso
Copy link
Author

elpaso commented Apr 8, 2024

@elpaso Does your grant application also include #264 ? I'm asking since the proposal lists 264 but only 265 is tagged with Grant-2024.

Yes, the proposal include boths, I will add the grant tag now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants