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

From: "Jelte Fennema-Nio" <postgres(at)jeltef(dot)nl>
To: "PostgreSQL Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: "Daniel Gustafsson" <daniel(at)yesql(dot)se>
Subject: Add "format" target to make and ninja to run pgindent and pgperltidy
Date: 2025-12-31 11:35:51
Message-ID: DFCDD5H4J7VX.3GJKRBBDCKQ86@jeltef.nl
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This tries to make running formatting a lot easier for committers, but
primarily for new contributors. You can not format the files by simply
running one of the folowing:

make format
ninja -C build format

My primary goal is to introduce Python formatting too (using ruff), and
integrate that in a similar manner. Right now we don't have many Python
files, but hopefully the pytest patch gets merged soonish and then we'll
get more and more Python files. So I'd like to get autoformatting out of
the gate.

But even without that, these rules should make it simpler to run the
current formatters:

Running pgindent is still not trivial for new users. You need to add our
pg_bsd_indent to PATH. And if you use meson to build you have to manually
specify src/ and contrib/ instead of ./ because otherwise pgindent will
try to format files in the build directory.

Running pgperltidy is even more complicated because you need to install
a specific version of perltidy. Recently we started erroring when that
version was not the one we expect.

Attachment Content-Type Size
v1-0001-Add-format-target-for-make-and-ninja.patch text/x-patch 4.1 KB
v1-0002-Allow-running-pgperltidy-from-any-directory.patch text/x-patch 1.2 KB
v1-0003-Add-pgpertidy-to-format-target.patch text/x-patch 18.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Henson Choi 2025-12-31 12:10:53 Re: Row pattern recognition
Previous Message Yugo Nagata 2025-12-31 10:44:55 Re: Allow to collect statistics on virtual generated columns