[Paraview-developers] [ANNOUNCE] ParaView coding style transition: use clang-format

Shawn Waldon shawn.waldon at kitware.com
Thu Oct 13 17:31:47 EDT 2016


Hi all,

VTK recently changed their code style rules to move curly braces to align
with the statement above.  When considering whether to follow this change,
the ParaView team has decided to use clang-format to auto-format our code.
I am putting together a branch that will convert all of the ParaView source
code to the clang-format style we have chosen [1]*.  Since this branch will
touch every C/C++ file, it is guaranteed to conflict will all outstanding
branches.

Here is the style we have decided on:
---
# This configuration requires clang-format 3.8 or higher.
BasedOnStyle: Mozilla
AlignAfterOpenBracket: DontAlign
AlignOperands: false
AlwaysBreakAfterReturnType: None
AlwaysBreakAfterDefinitionReturnType: None
BreakBeforeBraces: Allman
ColumnLimit: 100
Standard: Cpp03
...

I will be creating a one-shot conversion commit with the author "Kitware
Robot" using an automated script to apply the formatting across all of
ParaView's source and header files.  We plan to do this after the next RC
is tagged.  There will be an empty commit prior to the conversion commit
with instructions in its commit message for rebasing current branches
across the style transition.

We are adding a script in Utilities/Scripts/clang-format.bash to aid in
reformatting code.  It has options to reformat the currently changed code,
the amend the last commit or rewrite the current branch with the formatting
corrected (note: this is assuming the branch is based after the transition
commit, rebasing across the transition is trickier).  It also has an option
to reformat the entire ParaView codebase that I will be using to
automatically convert everything.

Shawn

[1]: https://gitlab.kitware.com/paraview/paraview/merge_requests/1097

*: this branch is out of date right now, but will be rebased and the
reformatting re-run before it is merged.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20161013/611c7aa8/attachment.html>


More information about the Paraview-developers mailing list