Re: Add "format" target to make and ninja to run pgindent and pgperltidy

From: "Jelte Fennema-Nio" <postgres(at)jeltef(dot)nl>
To: "Peter Eisentraut" <peter(at)eisentraut(dot)org>, "Andrew Dunstan" <andrew(at)dunslane(dot)net>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Ashutosh Bapat" <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: "PostgreSQL Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Daniel Gustafsson" <daniel(at)yesql(dot)se>
Subject: Re: Add "format" target to make and ninja to run pgindent and pgperltidy
Date: 2026-04-03 07:52:24
Message-ID: DHJCUQA4HF9H.10EN25MHG0YRW@jeltef.nl
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri Mar 27, 2026 at 2:32 PM CET, Peter Eisentraut wrote:
> I have committed these two.

Thanks!

> v3-0003-pgindent-Use-git-ls-files-to-discover-files.patch
>
> This looks structurally correct, but I wonder whether this:
>
> my @git_files = `git ls-files -- @dirs`;
>
> could be written in a way that is more robust against funny file names.
> (pgindent is also used against trees that are not stock PostgreSQL.)

I have changed it to use open so the args are not string interpolated
and -z so the resulting files are null-separated instead of
newline-separated. Is this the kind of thing you had in mind?

> v3-0004-pgindent-Default-to-indenting-the-current-directo.patch
>
> Note that other tools also share this behavior with pgindent:
>
> src/tools/pgindent/pgperltidy
> src/tools/perlcheck/pgperlcritic
> src/tools/perlcheck/pgperlsyncheck
>
> If we change one, we should change all.

I think that's fair, but because the other tools don't use git ls-files
I don't wanna do that in this commit.

Instead I updated the later commits to not just integrate pgperltidy
into pgindent, but create a new pgcheck tool that combines all of these
tools (the old scripts are kept as tiny wrappers). So after committing
all these tools behave the same way, not just in wheter no arguments
means "current directory" but also in all the flags they accept.

Attachment Content-Type Size
v4-0001-pgindent-Use-git-ls-files-to-discover-files.patch text/x-patch 2.8 KB
v4-0002-pgindent-Default-to-indenting-the-current-directo.patch text/x-patch 1.1 KB
v4-0003-pgindent-Allow-parallel-pgindent-runs.patch text/x-patch 7.1 KB
v4-0004-pgindent-Try-to-find-pg_bsd_indent-binary-in-comm.patch text/x-patch 2.1 KB
v4-0005-Move-pgindent-to-separate-pgcheck-script.patch text/x-patch 1.3 KB
v4-0006-Combine-all-formatting-and-linting-tools-into-pgc.patch text/x-patch 20.0 KB
v4-0007-pgcheck-Add-easy-way-of-getting-perltidy.patch text/x-patch 5.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2026-04-03 08:22:59 Re: vectorized CRC on ARM64
Previous Message Henson Choi 2026-04-03 06:58:39 Re: [WIP] Pipelined Recovery