[postgis-devel] Code formatting digging in

Tomas Vondra tomas.vondra at 2ndquadrant.com
Fri Feb 23 05:51:39 PST 2018


On 02/23/2018 12:21 PM, Sandro Santilli wrote:
> On Thu, Feb 22, 2018 at 11:26:39PM +0100, Tomas Vondra wrote:
>> AFAIK that only includes header files, so no - pgindent is not there.
>> But it's not like it's a massive tool - you can get it here:
>>
>>     https://github.com/postgres/postgres/tree/master/src/tools/pgindent
>>
>> and include it in PostGIS. Or to be more precise, it's a separate tool
>> available here:
>>
>>     https://git.postgresql.org/git/pg_bsd_indent.git
> 
> Ok then it would be good for our use.
> Sum of *.c *.h and README* is 160K vs. 664K of astyle.
> And pg_bsd_indent is C code instaed of C++, which means we don't
> need to require an additional compiler.
> 
>> Not really, it tends to be very stable. One of the primary reasons why
>> we have pgindent is to make all the branches more alike, to make
>> back-patching simpler. Changing the formatting rules between releases
>> would directly contradict that.
> 
> I'm sold, did I hear you volunteering to send a PR for integration
> of that package in PostGIS ? Or I'll get to that eventually.
> 

I can do that, yes. I suggest we do that in two steps:

1) getting the tooling in - essentially copy of src/tools/pgindent with
changes to paths, exclude patterns, Makefile stuff, etc.

2) initial run on the code base - I have no idea how noisy this will get
at this point. It should be done on all supported branches, otherwise
it'll make back-patching more difficult.

I don't think (1) should be committed until there's a clear idea how
much noise (2) will cause. That is, let's get (1) and (2) ready,
evaluate the results and then decide if pgindent is the right choice.


regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


More information about the postgis-devel mailing list