[geos-devel] astyle followup

Sandro Santilli strk at kbt.io
Wed May 22 11:04:54 PDT 2019


As I noticed astyle was recently included in the GEOS source tree
(tools/astyle) I thought I'd move another little step in the
direction of having some style enforced by tools.

Result of this excercise was the creation of an astyle wrapper
which landed in tools/astyle.sh that you can pass a list of files
to operate one.

For a test I run it against all the .cpp files in our tree,
except for astyle/ source code itself. The resulting stats:

 317 files changed, 7672 insertions(+), 7634 deletions(-)

Of those 317 files changed:

  120 have less than 10 lines changed
  179 have more than 10 but less than 100 lines changed
   12 have more than 100 lines changed

Those 12 "big offenders" are, in order of lines changed:

   src/operation/polygonize/PolygonizeGraph.cpp       |  100 +-
   src/triangulate/quadedge/QuadEdgeSubdivision.cpp   |  100 +-
   src/io/WKTReader.cpp                               |  102 +-
   src/operation/distance/DistanceOp.cpp              |  102 +-
   src/io/WKTWriter.cpp                               |  106 +-
   src/geom/GeometryFactory.cpp                       |  120 +-
   tests/unit/operation/polygonize/PolygonizeTest.cpp |  120 +-
   src/operation/valid/IsValidOp.cpp                  |  136 +-
   src/operation/overlay/OverlayOp.cpp                |  140 +-
   src/geom/Geometry.cpp                              |  146 +-
   .../intersection/RectangleIntersection.cpp         |  148 +-
   src/operation/valid/MakeValid.cpp                  |  148 +-
   src/algorithm/LineIntersector.cpp                  |  202 +-
   doc/example.cpp                                    |  230 +-
   tests/xmltester/XMLTester.cpp                      |  500 ++-
   capi/geos_ts_c.cpp                                 | 1642 ++++-----
   tests/xmltester/tinyxml2/tinyxml2.cpp              | 1939 +++++------
   tests/xmltester/Stackwalker.cpp                    | 3511 ++++++++++----------

I found out that the astyle configuration will NOT touch multi-line
comments, so style drifts in alignment of `*' symbols in those blocks
won't be fixed.

I think we could play with astyle configuration and see which options
give us the less changes. For example I found that dropping --pad-header
gives us less changes:

 24 files changed, 3056 insertions(+), 3019 deletions(-)


--strk;

  ()   Free GIS & Flash consultant/developer
  /\   https://strk.kbt.io/services.html


More information about the geos-devel mailing list