Re: Add "format" target to make and ninja to run pgindent and pgperltidy - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Add "format" target to make and ninja to run pgindent and pgperltidy
Date
Msg-id 58f59ede-a0ea-4167-b46a-ea36f4c9eb4a@dunslane.net
Whole thread Raw
In response to Re: Add "format" target to make and ninja to run pgindent and pgperltidy  (Peter Eisentraut <peter@eisentraut.org>)
List pgsql-hackers
On 2026-03-12 Th 5:10 AM, Peter Eisentraut wrote:
> On 04.03.26 10:18, Jelte Fennema-Nio wrote:
>> On Wed Dec 31, 2025 at 4:48 PM CET, Andrew Dunstan wrote:
>>> I'd kinda like to unify these universes, though. We could import the 
>>> pgperltidy logic into pgindent but disable it unless some flag were 
>>> given and the correct version of perltidy were present.
>>
>> Attached is an initial patchset that does that, as well as improving
>> pgindent in various other ways. This has removed the make/meson
>> integration and instead made pgindent smarter at finding pg_bsd_indent
>> and perltidy. I believe that with all of these QoL improvements we could
>> enable perltidy in pgindent by default (after doing a full indent run).
>>
>> I want to call pretty much all of this code was written by Claude Code
>> (i.e. an AI). I plan to do another review pass over this code soonish.
>> Especially the later commits, which I haven't checked in detail yet.
>> But for now I at least wanted to share the direction of what I've been
>> working on, because I saw that Peter marked himself as reviewer on the
>> commitfest app and I don't think it makes sense for him to look at the
>> previous patchset.
>
> Apparently, this is still work in progress, but here are some comments 
> from me.
>
> I'm very interested in the patch "pgindent: Clean up temp files on 
> SIGINT", because this is an annoying problem.  But I didn't find any 
> documentation about why this is the correct solution.  I didn't find 
> anything on the File::Temp man page, for example.  Do you have more 
> details?
>
> The patch "pgindent: Use git ls-files to discover files" is also 
> interested and pretty straightforward.  I guess we don't really care 
> about being able to run this in non-git trees?
>
> The other stuff I don't think I'm really on board with.  In 
> particular, I don't like integrating pgperltidy into pgindent. These 
> things are in practice run at different times and the underlying tools 
> update differently and require different management, so integrating 
> them all might lead to various annoyances.
>
> I kind of liked the original idea of a "make format", and then you 
> could have subtargets like "make format-c" and "make format-perl" if 
> you don't have all the tools.
>
> The parallel pgindent is pretty nice, but I wonder how "use POSIX" 
> works on Windows?


POSIX is ok. fork() can be dubious (see `perldoc perlfork`). But we 
could disable the parallel stuff on Windows if necessary.


cheers


andrew


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




pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Skipping schema changes in publication
Next
From: Daniel Gustafsson
Date:
Subject: Re: Add "format" target to make and ninja to run pgindent and pgperltidy