Re: Add --check option to pgindent

Andrew Dunstan <andrew@dunslane.net>

From: Andrew Dunstan <andrew@dunslane.net>
To: Jelte Fennema-Nio <postgres@jeltef.nl>, Daniel Gustafsson <daniel@yesql.se>
Cc: Tristan Partin <tristan@neon.tech>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Tom Lane <tgl@sss.pgh.pa.us>, Euler Taveira <euler@eulerto.com>, Michael Banck <mbanck@gmx.net>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2023-12-19T13:51:41Z
Lists: pgsql-hackers
On 2023-12-18 Mo 11:14, Jelte Fennema-Nio wrote:
> On Mon, 18 Dec 2023 at 13:42, Daniel Gustafsson <daniel@yesql.se> wrote:
>> I think this is pretty much ready to go, the attached v4 squashes the changes
>> and fixes the man-page which also needed an update.  The referenced Wiki page
>> will need an edit or two after this goes in, but that's easy enough.
> One thing I'm wondering: When both --check and --diff are passed,
> should pgindent still early exit with 2 on the first incorrectly
> formatted file? Or should it show diffs for all failing files? I'm
> leaning towards the latter making more sense.


It should show them all.


>
> Related (but not required for this patch): For my pre-commit hook I
> would very much like it if there was an option to have pgindent write
> the changes to disk, but still exit non-zero, e.g. a --write flag that
> could be combined with --check just like --diff and --check can be
> combined with this patch. Currently my pre-commit hook need two
> separate calls to pgindent to both abort the commit and write the
> required changes to disk.


Not sold on this. I don't want pgindent applied automatically to my 
uncommitted changes, but I do want a reminder that I forgot to run it. 
In any case, as you say it's a different topic.


cheers


andrew

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




Commits

  1. Rename pgindent options