Re: [PATCH] pg_bsd_indent: improve formatting of multiline comments - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] pg_bsd_indent: improve formatting of multiline comments
Date
Msg-id 206322.1777912819@sss.pgh.pa.us
Whole thread
In response to Re: [PATCH] pg_bsd_indent: improve formatting of multiline comments  (Aleksander Alekseev <aleksander@tigerdata.com>)
Responses Re: [PATCH] pg_bsd_indent: improve formatting of multiline comments
Re: [PATCH] pg_bsd_indent: improve formatting of multiline comments
List pgsql-hackers
Aleksander Alekseev <aleksander@tigerdata.com> writes:
> Thanks, Nathan. Re-submitting v6 to make it visible by cfbot again and
> in order to simplify the work of reviewers a bit.

I tested the v6 patch by running it on current HEAD.  Pretty nearly all
the changes it makes are improvements, but it seems like there's still
some work to be done.  In particular, in src/port/inet_aton.c it
produces this diff:

--- a/src/port/inet_aton.c
+++ b/src/port/inet_aton.c
@@ -36,7 +37,8 @@
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.  */
+ * SUCH DAMAGE. 
+ */
 
 #include "c.h"

in which not all the trailing whitespace has been removed from the
first line, causing "git diff --check" to complain:

$ git diff --check
src/port/inet_aton.c:40: trailing whitespace.
+ * SUCH DAMAGE. 

In this case the problem is that the cleanup pattern only accounts for
one trailing space.  But a variant of this, which I think affects many
of the steps in the patch, is that there could be tab(s) there.  You
should fix the patterns to allow any number of spaces/tabs at the
spots where they currently expect just one space.  This might result
in finding cleanups they miss now.

Another amusing diff I noticed:

--- a/src/backend/partitioning/partbounds.c
+++ b/src/backend/partitioning/partbounds.c
@@ -5713,7 +5713,7 @@ check_parent_values_in_new_partitions(Relation parent,
  * 3. In case new partitions don't contain the DEFAULT partition and the
  *      partitioned table does not have the DEFAULT partition, the following
  *      should be true: the sum of the bounds of new partitions should be equal
- &      to the bound of the split partition.
+ * &      to the bound of the split partition.
  *
  * parent:            partitioned table
  * splitPartOid:    split partition Oid

Clearly, this is somebody's off-by-one-key typo, and the correct
fix is s/&/*/.  I suspect that fixing that manually is the most
expedient answer, rather than trying to make pg_bsd_indent smart
enough to DTRT.

One other nitpick is that the patch itself needs to be run through
pgperltidy (which has different opinions than your editor about
tabs vs spaces, apparently).

            regards, tom lane



pgsql-hackers by date:

Previous
From: "Tristan Partin"
Date:
Subject: Re: Cleanup: Replace sscanf with strtol/strtoul in snapmgr
Next
From: Nathan Bossart
Date:
Subject: Re: [PATCH] pg_bsd_indent: improve formatting of multiline comments