Thread

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

    Jelte Fennema-Nio <postgres@jeltef.nl> — 2025-12-31T11:35:51Z

    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.