[postgis-devel] Code formatting digging in

Sandro Santilli strk at kbt.io
Fri Feb 23 03:27:35 PST 2018


On Fri, Feb 23, 2018 at 10:11:01AM +0000, Darafei "Komяpa" Praliaskouski wrote:

> 1. astyle currently doesn't pass CI, clang-format does.

I've fixed astyle Makefile (was using CFLAGS for C++ compilation,
and Travis passed CFLAGS were not valid for C++).

> 2. astyle doesn't do anything on line length:
> https://github.com/Komzpa/postgis/pull/3/files#diff-cfb8f8761c5379a23860242267edde72L93

Tomas: does pg_indent support splitting long lines ?
Darafei: astyle does support it, only current configuration isn't
asking for that, see http://astyle.sourceforge.net/astyle.html#_max-code-length

> 3. astyle doesn't attempt at fixing typography, so there are spaces before
> 4. clang-format aligns blocks of comments between different lines:
> 5. clang-format can get rid of weird newlines
> 6. clang-format deals with #define's internals
> 7. clang-format deals with function return type
> 8. clang-format deals with pointer alignment

Too many things to check with astyle, I don't really care as long as
we have a bot checking that a given style is consistently retained.

> We can vendor a clang-format binary in a nearby repo, just like
> https://github.com/angular/clang-format

Binary in a repo ? No please.

> I've seen that debbie has commit access to postgis repo. How about asking
> her to regularly (on commit, or on release for starters) run clang-format
> and commit, possibly duplicating previous commit header so that people who
> don't know `git diff -w`/`git blame -w` can still find the time, date and
> commit when change happened?

Would make a lot of change noise, -1 from me.

--strk;


More information about the postgis-devel mailing list