Re: Improve pgindent exclude handling: ignore empty lines

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Improve pgindent exclude handling: ignore empty lines
Date: 2025-02-14 15:23:47
Message-ID: c82c08d6-664f-4901-b647-5bef8668a1f7@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2025-02-08 Sa 4:39 AM, Zsolt Parragi wrote:
> 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 ".*"

It seems reasonable to ignore an empty line. But your proposed commit
message isn't correct w.r.t. whitespace, either relating to current or
proposed behaviour. i.e. comment lines can't have leading whitespace,
and you patch won't ignore lines wconsisting of one or more whitespace
characters. So I'm not quite clear what you want to do.

cheers

andrew

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Dolgov 2025-02-14 15:40:03 Re: pg_stat_statements and "IN" conditions
Previous Message Daniel Gustafsson 2025-02-14 15:15:20 Re: Allow default \watch interval in psql to be configured