Hello everybody,

Since I noticed that many of the developers' comments on PRs are targeted
to fix code formatting and style, I thought it would be very useful to have
a way to reduce the time spent on these small issues (and therefore, gain
more time to focus on the "working" code).

There is a tool called `clang-format` that can be used to format a piece of
code to follow predefined style guidelines. There is also a python script
called `git-clang-format` that can be used to check if commits respect
these guidelines and to produce diffs (with newly formatted code) that can
be later applied with the `git apply` command.

It is also possible to configure Travis to make a build fail if the code is
not consistent with the coding conventions. For example, ROOT
<https://github.com/root-project/root> is a big project that uses this
approach to validate its PRs.

We could make our personalized clang-format configuration (that is almost
trivial) and simply write a custom script which will be executed by Travis
before the build process to make sure that all the code submitted is well
written.

I think this could be a great addition to the project since it will produce
a more readable and consistent Shogun codebase over time.

Here some further references:

   - https://clang.llvm.org/docs/ClangFormat.html
   - https://clang.llvm.org/docs/ClangFormatStyleOptions.html
   - https://github.com/llvm-mirror/clang/blob/master/
   tools/clang-format/git-clang-format
   
<https://github.com/llvm-mirror/clang/blob/master/tools/clang-format/git-clang-format>

What do you think? Could it be worth the effort?

Cheers,
Giovanni De Toni

Reply via email to