wenying dai
wenying dai

Reputation: 61

How to make CLion auto format C++ code with Google code style, and pass the google cpplint check

I need to auto format my C++ code with google code style, and pass the cpplint check.

I have used + + L to auto format my code in CLion, but the code after format still not follow the google code style.

And I installed the CLion-cpplint plugin, this plugin only tell me where it does not follow the style. But I need a tool to auto format it.

Thanks.

Upvotes: 1

Views: 2895

Answers (1)

uta
uta

Reputation: 2069

  1. In the root of your project create the file with the name .clang-format and the line BasedOnStyle: Google inside
  2. Turn on ClangFormat as default formatter ClangFormat as default formatter
  3. In Git-commit dialog add Reformat code action <code>Reformat code</code> action

Upvotes: 3

Related Questions