[postgis-devel] Code formatting digging in

Mateusz Loskot mateusz at loskot.net
Thu Feb 22 11:35:07 PST 2018


On 22 February 2018 at 19:57, Darafei "Komяpa" Praliaskouski
<me at komzpa.net> wrote:
>
> Two things are crucial about clang-format:
> 1. clang-format is part of clang/llvm, so it's reusing parts of the same
> engine that parses the code on compilation;
> 2. clang-format ships git-clang-format that is able to format just a patch.

Since PostGIS/GEOS developers overlap, this has been discussed as per
GEOS RFC 4 [1], and it didn't receive much love.

> Even if committer has different clang-format version, if they use
> git-clang-format they'll change only the lines they would have edited
> anyway, so that situation with someone having incompatible version is not
> making things worse.

Or, it is making things less worse.

> In that it's majorly different from astyle way from
> years ago when it was a complete project reformat on every commit.
>
> In PR Raul mentioned I'm reformatting all the code, but it doesn't have to
> be done in one go - I mostly wanted to test it's producing sane compiling
> output.

AFAIU, you were mixing functional changes with non-functional changes
which, typically, is no-go.

> Minimal change is dragging in .clang-format from that PR and start routinely
> using it on commits.

What are disadvantages of reformatting in small steps?
Apart from diffs hard to review due to mixing func/non-func changes, etc.

As per my suggestion in the RFC, for GEOS we discussed bulk reformat in one go
and I referred to experience of MongoDB (linked in the RFC) as an example
of a large codebase/community that can live with it.

Sandro objected [1] due to "log clutter and post-reformat svn/git blame issues".
Dropping of GEOS RFC4 makes me feel, well, 'unfulfilled', so I'm very
keen to learn
from PostGIS (improved) experience.


[1] https://trac.osgeo.org/geos/wiki/RFC4
[2] https://lists.osgeo.org/pipermail/geos-devel/2017-April/007752.html

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the postgis-devel mailing list