Thread

Commits

  1. Ignore blank lines in pgindent exclude files

  1. Improve pgindent exclude handling: ignore empty lines

    Zsolt Parragi <zsolt.parragi@percona.com> — 2025-02-08T09:39:29Z

    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 ".*"
    
  2. Re: Improve pgindent exclude handling: ignore empty lines

    Andrew Dunstan <andrew@dunslane.net> — 2025-02-14T15:23:47Z

    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
    
    
    
    
    
  3. Re: Improve pgindent exclude handling: ignore empty lines

    Zsolt Parragi <zsolt.parragi@percona.com> — 2025-02-18T20:02:13Z

    Hello
    
    You are right, when I was writing the commit message I was thinking
    about trim, but the script only uses chomp.
    
    I edited the commit message to correctly describe the new behavior:
    ignoring only the empty line, as that was my main intention with the
    patch.
    
    On Fri, Feb 14, 2025 at 3:24 PM Andrew Dunstan <andrew@dunslane.net> wrote:
    >
    >
    > 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://url.avanan.click/v2/r01/___https://www.enterprisedb.com___.YXAzOnBlcmNvbmE6YTpnOjgzNDM4NzkxMGRhNTliMWY3M2JkZDNlYzg2MmNmZDM3Ojc6MGFhNjo0MDFkNDY2NzYzN2QyNjM5YmI1NWY0ZWMwZjI0M2JkZTU5MjMxZDFmODhmZGE3MmRjYjlhYjEyZDViYTk5NWZlOnA6VDpO
    >
    
  4. Re: Improve pgindent exclude handling: ignore empty lines

    Andrew Dunstan <andrew@dunslane.net> — 2025-02-20T16:40:53Z

    On 2025-02-18 Tu 3:02 PM, Zsolt Parragi wrote:
    > Hello
    >
    > You are right, when I was writing the commit message I was thinking
    > about trim, but the script only uses chomp.
    >
    > I edited the commit message to correctly describe the new behavior:
    > ignoring only the empty line, as that was my main intention with the
    > patch.
    
    
    
    
    pushed, thanks.
    
    
    cheers
    
    
    andrew
    
    --
    Andrew Dunstan
    EDB: https://www.enterprisedb.com