Re: run pgindent on a regular basis / scripted manner

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Noah Misch <noah(at)leadboat(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Bruce Momjian <bruce(at)momjian(dot)us>, Jelte Fennema <postgres(at)jeltef(dot)nl>, Peter Geoghegan <pg(at)bowt(dot)ie>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Jesse Zhang <sbjesse(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: run pgindent on a regular basis / scripted manner
Date: 2023-04-23 15:08:42
Message-ID: 600db31e-d006-f8f2-7443-c1c7d5aae0cd@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2023-04-22 Sa 16:15, Tom Lane wrote:
> Noah Misch<noah(at)leadboat(dot)com> writes:
>> - skip if the break-glass "pgindent: no" appears in a commit message
> There are two things that bother me about putting this functionality
> into a server hook, beyond the possible speed issue:
>
> * The risk of failure. I don't have a terribly difficult time imagining
> situations where things get sufficiently wedged that the server accepts
> *no* commits, not even ones fixing the problem. An override such as
> you suggest here could assuage that fear, perhaps.
>
> * The lack of user-friendliness. AFAIK, if a pre-receive hook fails
> you learn little except that it failed. This could be extremely
> frustrating to debug, especially in a situation where your local
> pgindent is giving you different results than the server gets.
>
> The idea of a buildfarm animal failing if --show-diff isn't empty
> is attractive to me mainly because it is far nicer from the
> debuggability standpoint.
>
> Maybe, after we get some amount of experience with trying to keep
> things always indent-clean, we will decide that it's reliable enough
> to enforce in a server hook. I think going for that right away is
> sheer folly though.
>
>

What I'll do for now is set up a buildfarm module that will log the
differences but won't error out if there are any. At least that way
we'll know better what we're dealing with.

I don't really like Noah's idea of having a pre-receive hook possibly
spew thousands of diff lines to the terminal.

cheers

andrew

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-04-23 15:16:10 Re: run pgindent on a regular basis / scripted manner
Previous Message Andrew Dunstan 2023-04-23 15:04:33 Re: run pgindent on a regular basis / scripted manner