pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Banck <mbanck@gmx.net>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: Tristan Partin <tristan@neon.tech>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Add --check option to pgindent
Date: Tue, 12 Dec 2023 11:28:10 +0100
Message-ID: <657835bb.500a0220.a88d.2058@mx.google.com> (raw)
In-Reply-To: <C4149FA1-AB7F-4869-8A5B-A029A70212CB@yesql.se>
References: <CXLX2XYTH9S6.140SC6Y61VD88@neon.tech>
	<C4149FA1-AB7F-4869-8A5B-A029A70212CB@yesql.se>

Hi,

On Tue, Dec 12, 2023 at 11:18:59AM +0100, Daniel Gustafsson wrote:
> > On 12 Dec 2023, at 01:09, Tristan Partin <tristan@neon.tech> wrote:
> > 
> > Not sold on the name, but --check is a combination of --silent-diff
> > and --show-diff. I envision --check mostly being used in CI
> > environments. I recently came across a situation where this behavior
> > would have been useful. Without --check, you're left to capture the
> > output of --show-diff and exit 2 if the output isn't empty by
> > yourself.
> 
> I wonder if we should model this around the semantics of git diff to
> keep it similar to other CI jobs which often use git diff?  git diff
> --check means "are there conflicts or issues" which isn't really
> comparable to here, git diff --exit-code however is pretty much
> exactly what this is trying to accomplish.
> 
> That would make pgindent --show-diff --exit-code exit with 1 if there
> were diffs and 0 if there are no diffs.

To be honest, I find that rather convoluted; contrary to "git diff", I
believe the primary action of pgident is not to show diffs, so I find
the proposed --check option to be entirely reasonable from a UX
perspective.

On the other hand, tying a "does this need re-indenting?" question to a
"--show-diff --exit-code" option combination is not very obvious (to me,
at least).


Cheers,

Michael





view thread (31+ messages)  latest in thread

Message-ID: <657835bb.500a0220.a88d.2058@mx.google.com>
Permalink:  ../657835bb.500a0220.a88d.2058@mx.google.com/
Also on:    postgresql.org/message-id/657835bb.500a0220.a88d.2058@mx.google.com

 · 

reply

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: mbanck@gmx.net, daniel@yesql.se, tristan@neon.tech
  Subject: Re: Add --check option to pgindent
  In-Reply-To: <657835bb.500a0220.a88d.2058@mx.google.com>
  References: <CXLX2XYTH9S6.140SC6Y61VD88@neon.tech> <C4149FA1-AB7F-4869-8A5B-A029A70212CB@yesql.se> <657835bb.500a0220.a88d.2058@mx.google.com>

* 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