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>, Andres Freund <andres(at)anarazel(dot)de>
Cc: Jelte Fennema <postgres(at)jeltef(dot)nl>, Peter Geoghegan <pg(at)bowt(dot)ie>, Bruce Momjian <bruce(at)momjian(dot)us>, Magnus Hagander <magnus(at)hagander(dot)net>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Noah Misch <noah(at)leadboat(dot)com>, 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-02-03 16:44:46
Message-ID: de0a7034-0186-1f91-b408-eb67f2a854dc@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2023-01-22 Su 17:47, Tom Lane wrote:
> Andres Freund<andres(at)anarazel(dot)de> writes:
>> I strongly dislike it, I rarely get it right by hand - but it does have some
>> benefit over aligning variable names based on the length of the type names as
>> uncrustify/clang-format: In their approach an added local variable can cause
>> all the other variables to be re-indented (and their initial value possibly
>> wrapped). The fixed alignment doesn't have that issue.
> Yeah. That's one of my biggest gripes about pgperltidy: if you insert
> another assignment in a series of assignments, it is very likely to
> reformat all the adjacent assignments because it thinks it's cool to
> make all the equal signs line up. That's just awful. You can either
> run pgperltidy on new code before committing, and accept that the feature
> patch will touch a lot of lines it's not making real changes to (thereby
> dirtying the "git blame" history) or not do so and thereby commit code
> that's not passing tidiness checks. Let's *not* adopt any style that
> causes similar things to start happening in our C code.

Modern versions of perltidy give you much more control over this, so
maybe we need to investigate the possibility of updating. See the latest
docco at
<*https://metacpan.org/dist/Perl-Tidy/view/bin/perltidy#Completely-turning-off-vertical-alignment-with-novalign>
*

Probably we'd want to use something like

|--valign-exclusion-list=||'= => ,'|
||
||
|cheers|
||
|andrew|

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-02-03 17:52:50 Re: run pgindent on a regular basis / scripted manner
Previous Message Laurenz Albe 2023-02-03 16:14:29 Re: Make EXPLAIN generate a generic plan for a parameterized query