Re: run pgindent on a regular basis / scripted manner

Andrew Dunstan <andrew@dunslane.net>

From: Andrew Dunstan <andrew@dunslane.net>
To: Tom Lane <tgl@sss.pgh.pa.us>, Noah Misch <noah@leadboat.com>
Cc: Magnus Hagander <magnus@hagander.net>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Andres Freund <andres@anarazel.de>, Bruce Momjian <bruce@momjian.us>, Jelte Fennema <postgres@jeltef.nl>, Peter Geoghegan <pg@bowt.ie>, Alvaro Herrera <alvherre@2ndquadrant.com>, Stephen Frost <sfrost@snowman.net>, Jesse Zhang <sbjesse@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2023-04-23T15:08:42Z
Lists: pgsql-hackers
On 2023-04-22 Sa 16:15, Tom Lane wrote:
> Noah Misch<noah@leadboat.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

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix comment from commit 22655aa231.

  2. Add a few recent commits to .git-blame-ignore-revs.

  3. Pre-beta2 mechanical code beautification.

  4. Pre-beta mechanical code beautification.

  5. Make agreed-on updates in perltidy options.

  6. Remove obsolete pgindent options --code-base and --build

  7. Integrate pg_bsd_indent into our build/test infrastructure.

  8. Sync pg_bsd_indent's copyright notices with Postgres practice.

  9. Import pg_bsd_indent sources.

  10. pgindent: filter files for the --commit option

  11. pgindent: more ways to find files to indent

  12. Fix pgindent --show-diff option.

  13. Add non-destructive modes to pgindent

  14. Initial pgindent run with pg_bsd_indent version 2.0.