[QGIS-Developer] pre-commit for code-formatting

Even Rouault even.rouault at spatialys.com
Thu Dec 12 07:38:09 PST 2024


Le 12/12/2024 à 16:33, Julien Cabieces via QGIS-Developer a écrit :
> Not a great fan of this approach, It looks like complicated to me, I would prefer the old behavior.
>
> Those automatic PR force also contributor to rebase before pushing new
> modification to their branch. And if they have modified area of code
> which have been reformatted, they get conflicts.
>
> automatic pre-commit commits brings more difficulties than what it
> solves IMHO.

I also tend to agree on that. On other projects I'm involved too (GDAL, 
PROJ, shapelib, libtiff) where we have put in place pre-commit, we just 
have a CI check that checks the formatting is OK. This requires a bit of 
education to first time contributors, but pointing to the documentation 
with clear instructions on how to setup pre-commit should be good 
enough. 
https://github.com/qgis/QGIS/edit/master/.github/PULL_REQUEST_TEMPLATE.md 
could also have some words about it

Like in 
https://github.com/OSGeo/gdal/edit/master/.github/PULL_REQUEST_TEMPLATE.md 
, " - [ ] Make sure code is correctly formatted (cf [pre-commit 
configuration](https://gdal.org/development/dev_practices.html#commit-hooks))"

-- 
http://www.spatialys.com
My software is free, but my time generally not.
Butcher of all kinds of standards, open or closed formats. At the end, this is just about bytes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20241212/786d1e26/attachment.htm>


More information about the QGIS-Developer mailing list