[postgis-devel] Code formatting digging in

Darafei "Komяpa" Praliaskouski me at komzpa.net
Wed Feb 28 06:34:08 PST 2018


I've tried running pgindent.

TLDR: pgindent heavily broken, style ported to clang-format, let's use
clang-format with pgindent style.

https://github.com/postgis/postgis/pull/226

 - it arbitrarily uncomments code,
https://github.com/postgis/postgis/pull/226/files#diff-6bc61232f3b565f3dcc84d60ad377e21L14
;
 - it breaks preformatted comments,
https://github.com/postgis/postgis/pull/226/files#diff-398fded035024e0cd5d922b19ada5c68L443
;
 - it breaks e-mails in comments,
https://github.com/postgis/postgis/pull/226/files#diff-1ec0062960e90bc800dc321fd582e760L5
;
 - it breaks ascii art in comments,
https://github.com/postgis/postgis/pull/226/files#diff-a8d63a29cc2e89c5928aae29f5a6485eL109
;
 - pointer alignment is weird,
https://github.com/postgis/postgis/pull/226/files#diff-cfb8f8761c5379a23860242267edde72R164
;
 - it just makes code not compile,
https://travis-ci.org/postgis/postgis/jobs/347246746
 - while formatting, it reports unbalanced parenthesis (which isn't true on
svn trunk).

I suspect that it's possible to write code and comments in subset of C and
English compatible with pgindent, but PostGIS isn't this way, it can't be
used directly.
I didn't prepare a compare pull request, it doesn't make sense to reformat
a broken code :)

Some practices from pgindent and postgres code stylestill can be adopted
though even the tool does not fit. I ported Postgres brace style to
.clang-format in my PR.

clang-format that looks like pgindent, checks PRs on travis and formats
more than astyle is here:
https://github.com/postgis/postgis/pull/220/files#diff-86f75d20942198273bc1008963770816


Let's merge it? :)

сб, 24 февр. 2018 г. в 0:16, Sandro Santilli <strk at kbt.io>:

> On Fri, Feb 23, 2018 at 02:51:39PM +0100, Tomas Vondra wrote:
> > On 02/23/2018 12:21 PM, Sandro Santilli wrote:
>
> > > 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.
>
> Done already: check out "pgindent" branch on Gitea or GitLab mirrors.
>
> > 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.
>
> You're welcome to continue from where I left and do (2).
> It will get noise, but now we have the astyle and clang-format
> branches too for comparing and checking the noise difference.
>
> --strk;
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20180228/ce693c1d/attachment.html>


More information about the postgis-devel mailing list