[geos-devel] RFC 4: Code Formatting Style

Sandro Santilli strk at kbt.io
Thu Mar 23 10:42:37 PDT 2017


On Thu, Mar 23, 2017 at 06:25:05PM +0100, Mateusz Loskot wrote:

> For your delectation, RFC4 <http://trac.osgeo.org/geos/wiki/RFC4>

Thanks for the time you put into this Mateusz.
I like the idea of *enforcing* a style, but I'm of course concerned
about being able to deal with this in the future, and about history
destruction (git blame, as you call it).

About the first concern (deal with it):

We found out with PostGIS that changes in the formatting tool (astyle,
in that case) made it hard for developers to enforce a given style (ie:
different versions of the tool behaved differently). On Debian stable
(8.0) I find 3 distinct versions packaged (3.8, which you reference,
from backports):

  clang-format-3.4 - Tool to format C/C++/Obj-C code
  clang-format-3.5 - Tool to format C/C++/Obj-C code
  clang-format-3.8 - Tool to format C/C++/Obj-C code

On Ubuntu LTS (16.04) I have 4 (or 5):

  clang-format - Tool to format C/C++/Obj-C code
  clang-format-3.5 - Tool to format C/C++/Obj-C code
  clang-format-3.6 - Tool to format C/C++/Obj-C code
  clang-format-3.7 - Tool to format C/C++/Obj-C code
  clang-format-3.8 - Tool to format C/C++/Obj-C code

For comparison: QGIS developers embedded a version of astyle.c in their
codebase, so to ensure style won't change due to version of an external
piece of software. Not that bad, as it's a single .c file IIRC.

About the specification:

The clang-format document you suggest references an external entity
(BasedOnStyle) which may make this more of a problem (what happens if
the referenced style changes?).

The format specification you propose does not mention line ending, why ?

About history destruction:

You suggest to change .editor-config to match the new proposal, why not
doing the contrary instead, to avoid changing too much the existing
styles again ? For example .editor-config requests the use of TAB, which
are in use since a long time, why not keeping them ?

Had you run tests with your suggested style to check how many lines
would be changed ?

> Is there any interest to put the RFC4 to the vote?

Lets have it gather some of the requested comments first :)

--strk;


More information about the geos-devel mailing list