Re: run pgindent in CI - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: run pgindent in CI
Date
Msg-id 5a7c4ff5-361d-4f85-9bf9-83a6078a23b7@dunslane.net
Whole thread
In response to run pgindent in CI  (Peter Eisentraut <peter@eisentraut.org>)
Responses Re: run pgindent in CI
List pgsql-hackers
On 2026-09-22 Tu 3:10 AM, Peter Eisentraut wrote:
> Previously discussed in [0].  People seemed to generally like the idea 
> of running pgindent in CI but didn't want the job to fail outright if 
> there were violations.  My proposal here is to use a combination of 
> GitHub Actions features [1] to create job annotations and step 
> summaries to create some kind of warning output.  I have attached an 
> example screenshot.
>
> I also added a git whitespace check in the same way.  Additional 
> formatting checks like pgperltidy, Python stuff, etc. could be added 
> similarly.
>
> (I imagine there could be some cfbot integration that represents these 
> annotations in a non-threatening way, but I have not looked into that 
> at all.)
>
> One surprise from this is that this generates a massive pgindent diff 
> against the current tree, because there are a bunch of entries missing 
> or wrong in src/tools/pgindent/exclude_file_patterns.  I guess most 
> people don't see this because these are mostly generated files, which 
> would get reindented but then ignored via gitignore, but if you run 
> pgindent --check --diff, then this will show up.
>
> I don't exactly know how the buildfarm member koel gets away with 
> this. The notes say "Runs pgindent --show-diff", but that is not an 
> actual existing option.  One evident difference is that koel runs 
> meson, but I have added this to the existing CompilerWarnings job and 
> reused the tree from the headerscheck step, which uses autoconf.  
> Anyway, maybe this could be improved sometime to reduce variability, 
> but for now I have just included a patch to update 
> exclude_file_patterns as needed.


The notes are out of date re --show-diff.

You can see what koel does - it's a special buildfarm module at 
https://github.com/PGBuildFarm/client-code/blob/main/PGBuild/Modules/CheckIndent.pm

It just runs:

    src/tools/pgindent/pgindent --diff --check .

Of course, that's against a pure source tree. The build tree is 
elsewhere and the module never points pgindent at it. Even if koel were 
using configure/make, I would have set it up to do vpath builds.

Note that you can specify extra exclude files on pgindent's command line 
as well, so if your builddir is inside your source tree it would make 
sense to specify one pointing at the builddir. That's not going to help 
you if you build in-tree using configure/make. I guess I would say don't 
do that and then run pgindent.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com




pgsql-hackers by date:

Previous
From: Jeevan Chalke
Date:
Subject: Re: postgres_fdw: push down FETCH FIRST .. WITH TIES when server version allows
Next
From: Matthias van de Meent
Date:
Subject: Re: Adding a stored generated column without long-lived locks