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

Denis Rouzaud denis.rouzaud at gmail.com
Thu Dec 12 05:02:31 PST 2024


HI Julien,

Thanks for the feedback !

Le jeu. 12 déc. 2024 à 13:52, Julien Cabieces <julien.cabieces at oslandia.com>
a écrit :

>
> Hi Denis,
>
> Thanks for this work, it works like a charm!
>
> Could you add some instructions on how to use it and set it up correctly
> in the developer guide ?


This is already published in
https://docs.qgis.org/3.40/en/docs/developers_guide/git.html#procedure
Let me know if this needs to be improved.

>
>
> I think it's a great tool on developer side but I have my concerns about
> the CI part. It adds a lot of automatic commit which doesn't help when
> you want to read the git history. If you want to blame a specific line
> of code, you can land in this type of commit instead of the relevant
> modification you were heading to. You can trace it back to the pull
> request but it's one more step, and it makes us even more attached to the
> GitHub platform.
>

Thanks to Nyall's hint, I have added the refactoring commits to
https://github.com/qgis/QGIS/blob/master/.git-blame-ignore-revs
When I blame files online in Github it seems to be working:
For instance,
https://github.com/qgis/QGIS/blame/master/src/gui/actions/qgsactionmenu.h
Last commit is the pre-commit run but you don't see it in the blame.

But I have not done this job in the release-3_40 branch (in which I
manually backported).

More generally I am not super happy about clang-format being more painful
to play with our SIP macros but it's much easier than having to build a
dedicated tool. And having everything in a pre-commit config is much more
convenient and clearer/cleaner.

Best wishes,
Denis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20241212/46e571fe/attachment.htm>


More information about the QGIS-Developer mailing list