Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k60Sg-0004n2-SF for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Aug 2020 23:47:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k60Sf-00062C-QH for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Aug 2020 23:47:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k60Sf-000625-Jm for pgsql-hackers@lists.postgresql.org; Wed, 12 Aug 2020 23:47:13 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k60SY-0006vb-PD for pgsql-hackers@postgresql.org; Wed, 12 Aug 2020 23:47:13 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 07CNl1kt328085; Wed, 12 Aug 2020 19:47:01 -0400 From: Tom Lane To: Jesse Zhang cc: Andres Freund , PostgreSQL-development Subject: Re: run pgindent on a regular basis / scripted manner In-reply-to: References: <20200812223409.6di3y2qsnvynao7a@alap3.anarazel.de> Comments: In-reply-to Jesse Zhang message dated "Wed, 12 Aug 2020 16:08:50 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <328083.1597276021.1@sss.pgh.pa.us> Date: Wed, 12 Aug 2020 19:47:01 -0400 Message-ID: <328084.1597276021@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Jesse Zhang writes: > On Wed, Aug 12, 2020 at 3:34 PM Andres Freund wrote: >> Is there any reason we don't just automatically run pgindent regularly? >> Like once a week? And also update typedefs.list automatically, while >> we're at it? > You know what's better than weekly? Every check-in. I'm not in favor of unsupervised pgindent runs, really. It can do a lot of damage to code that was written without thinking about it --- in particular, it'll make a hash of comment blocks that were manually formatted and not protected with dashes. If the workflow is commit first and re-indent later, then we can always revert the pgindent commit and clean things up manually; but an auto re-indent during commit wouldn't provide that history. I do like the idea of more frequent, smaller pgindent runs instead of doing just one giant run per year. With the giant runs it's necessary to invest a fair amount of time eyeballing all the changes; if we did it every couple weeks then the pain would be a lot less. Another idea would be to have a bot that runs pgindent *without* committing the results, and emails the people who have made commits into files that changed, saying "if you don't like these diffs then you'd better clean up your commit before it happens for real". With some warning like that, it might be okay to do automatic reindenting a little bit later. Plus, nagging committers who habitually commit improperly-indented code might persuade them to clean up their acts ;-) regards, tom lane