From: Tristan Partin <tristan@neon.tech>
To: Jelte Fennema-Nio <postgres@jeltef.nl>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Euler Taveira <euler@eulerto.com>
Cc: Michael Banck <mbanck@gmx.net>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Add --check option to pgindent
Date: Mon, 18 Dec 2023 10:50:15 -0600
Message-ID: <CXRM4KD9NXIC.V372H4MRTMDT@neon.tech> (raw)
In-Reply-To: <CAGECzQS0zOsf3+NTxZPpBaBm7vivJwfZ=n=Qq0x62mRhFq52vQ@mail.gmail.com>
References: <202312121530.7vztxm3bfyrx@alvherre.pgsql>
<4b390361-484d-7598-ac13-db2dd7072ad3@dunslane.net>
<CXO7OZEZ53RE.1Q4SXU4WJ25RN@neon.tech>
<CAGECzQRAyCkzM=g9Sv149kXqfL_q4t7WdZ4wb_OizmUYhVrRyg@mail.gmail.com>
<CXP0TUOU4C1N.Z7Q508WQ4XJP@neon.tech>
<46DAFBD4-0387-4F8B-96A2-A39499600C32@yesql.se>
<CAGECzQS0zOsf3+NTxZPpBaBm7vivJwfZ=n=Qq0x62mRhFq52vQ@mail.gmail.com>
On Mon Dec 18, 2023 at 10:14 AM CST, 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.
Makes sense. Let me iterate on the squashed version of the patch.
> 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.
I could propose something. It would help if I had an example of such
a tool that already exists.
--
Tristan Partin
Neon (https://neon.tech)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tristan@neon.tech, postgres@jeltef.nl, daniel@yesql.se, andrew@dunslane.net, alvherre@alvh.no-ip.org, tgl@sss.pgh.pa.us, euler@eulerto.com, mbanck@gmx.net
Subject: Re: Add --check option to pgindent
In-Reply-To: <CXRM4KD9NXIC.V372H4MRTMDT@neon.tech>
References: <202312121530.7vztxm3bfyrx@alvherre.pgsql> <4b390361-484d-7598-ac13-db2dd7072ad3@dunslane.net> <CXO7OZEZ53RE.1Q4SXU4WJ25RN@neon.tech> <CAGECzQRAyCkzM=g9Sv149kXqfL_q4t7WdZ4wb_OizmUYhVrRyg@mail.gmail.com> <CXP0TUOU4C1N.Z7Q508WQ4XJP@neon.tech> <46DAFBD4-0387-4F8B-96A2-A39499600C32@yesql.se> <CAGECzQS0zOsf3+NTxZPpBaBm7vivJwfZ=n=Qq0x62mRhFq52vQ@mail.gmail.com> <CXRM4KD9NXIC.V372H4MRTMDT@neon.tech>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox