Improve pgindent exclude handling: ignore empty lines

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Improve pgindent exclude handling: ignore empty lines
Date: 2025-02-08 09:39:29
Message-ID: CAN4CZFOF7g96VcZ6Q+WERFySs787QmrkjVvL_dEuX8QBa-04xw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

We ran into an issue where pgindent stopped reformatting anything with
our custom exclude file, and after some investigation we found the
empty line accidentally inserted into the exclude file.

Pgindent currently treats empty lines as valid exclusions and creates
an empty regex from them. The empty regex matches any pattern,
resulting in ignoring everything.

As this behavior doesn't seem to be useful in practice, and it is easy
to reproduce accidentally (it works even at the end of the file), I
propose a patch that ignores empty lines in the exclude file.

If somebody really wants to ignore everything, that is still possible
with more explicit patterns like ".*"

Attachment Content-Type Size
0001-Improve-pgindent-exclude-handling-ignore-empty-lines.patch application/octet-stream 1.2 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2025-02-08 10:07:16 Re: Get rid of WALBufMappingLock
Previous Message Julien Rouhaud 2025-02-08 08:34:35 Re: proposal - plpgsql - support standard syntax for named arguments for cursors