C ++ Google-Style: automatic correction

I have a research project with several files (~ 100). The code has been written over the years without any particular style. Each developer (mainly master students who come, code and leave) used his own "style", if any.

Now I'm trying to save the code so that the new people who join us abide by certain rules. I found that Google posted some style guide . Fortunately, they also published a python script that is easy to use.

The problem is that the script gives me a tone for silly errors for each file, such as

Missing space after , [whitespace/comma] [3] 

or

 Missing space before { [whitespace/braces] [5] 

My question is : is it possible to automate the correction of such "errors"? This means that the script is working on a file that automatically fixes all these errors.

+7
c ++ checkstyle
source share
1 answer

clang-format can be useful since it can be launched with the ability to use Google style rules:

 clang-format -style=Google ... 

See http://clang.llvm.org/docs/ClangFormatStyleOptions.html

+8
source share

All Articles