public inbox for [email protected]  
help / color / mirror / Atom feed
From: Arseniy Mukhin <[email protected]>
To: Aleksander Alekseev <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: Michael Paquier <[email protected]>
Subject: Re: [PATCH] pg_bsd_indent: improve formatting of multiline comments
Date: Thu, 19 Jun 2025 23:33:55 +0300
Message-ID: <CAE7r3MJ=CcWw65=C=tET32z5joixFqMDY_XhCxvjpLcOL3nVAQ@mail.gmail.com> (raw)
In-Reply-To: <CAJ7c6TPQ0kkHQG-AqeAJ3PV_YtmDzcc7s+_V4=t+xgSnZm1cFw@mail.gmail.com>
References: <CAJ7c6TPQ0kkHQG-AqeAJ3PV_YtmDzcc7s+_V4=t+xgSnZm1cFw@mail.gmail.com>

On Thu, Jun 19, 2025 at 5:51 PM Aleksander Alekseev
<[email protected]> wrote:
>
> Hi,
>
> Michael (cc:'ed) pointed out [1] that pg_bsd_indent could do a
> slightly better job when it comes to formatting multiline comments. I
> prepared a patch that fixes this.
>
> How to test it:
>
> ```
> ninja -C build
> cp build/src/tools/pg_bsd_indent/pg_bsd_indent ~/bin/pg_bsd_indent
> cp src/tools/pgindent/pgindent ~/bin/pgindent
> pgindent src/backend/utils/adt/varlena.c
> git diff
> ```
>
> Expected changes:
>
> ```
> -/* name_text()
> +/*
> + * name_text()
>   * Converts a Name type to a text type.
>   */
> ```
>
> Everything else should work as before.
>
> Thoughts and feedback are most welcomed.
>
> [1]: https://postgr.es/m/CAJ7c6TN7ppSmZMPejvKZreOs%3D%2BkJEhrGQNuVpmTjj9W-%3DMjgCg%40mail.gmail.com
>
> --
> Best regards,
> Aleksander Alekseev

Hi Aleksander!

Thank you for the patch!

I tried it with the whole project and almost always it works great.
But I noticed two cases where it works probably not as expected:

1) comments which don't have a star on each line. For example:
file 'cube.c'

before:
/* make up a metric in which one box will be 'lower' than the other
   -- this can be useful for sorting and to determine uniqueness */

after:
/*
 * make up a metric in which one box will be 'lower' than the other
   -- this can be useful for sorting and to determine uniqueness */

2) comments where closing */ is on the last comment line. For example:
file 'crypt-blowfish.c'

before:
/* This has to be bug-compatible with the original implementation, so
 * only encode 23 of the 24 bytes. :-) */

after:
/*
 * This has to be bug-compatible with the original implementation, so
 * only encode 23 of the 24 bytes. :-) */


Best regards,
Arseniy Mukhin





view thread (26+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [PATCH] pg_bsd_indent: improve formatting of multiline comments
  In-Reply-To: <CAE7r3MJ=CcWw65=C=tET32z5joixFqMDY_XhCxvjpLcOL3nVAQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox