qgis / QGIS-Enhancement-Proposals

QEP's (QGIS Enhancement Proposals) are used in the process of creating and discussing new enhancements for QGIS
118 stars 37 forks source link

Use pre-commit to automate installation and management of all pre-commit hooks #265

Open elpaso opened 1 year ago

elpaso commented 1 year ago

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 commented 1 year ago

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

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

elpaso commented 1 year ago

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 commented 1 year ago

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

anitagraser commented 7 months ago

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 https://github.com/qgis/PSC/issues/58#issuecomment-1567892412)

anitagraser commented 7 months ago

@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 commented 7 months ago

@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.