About clang-format rule: "public: should be indented +1 space inside class"

2.8k Views Asked by At

I use clang-format with style=Google to do format job. clang-format version is 12.0.1. Formatted code likes this:

class SearchDoneService : public DoneService {
 public:
  explicit SearchDoneService(const string &);

But I donot get used with 2 spaces(IndentWidth:2). So I modify to IndentWidth:4. Now Formatted code likes this:

class SearchDoneService : public DoneService {
   public:
    explicit SearchDoneService(const string &);

It seems the keywords(public, private, protected) always keep 1 space distance from member function of class. But I use cpplint to do static checking. The screen prints this:

warning: public: should be indented +1 space inside class SearchDoneService

The warning is according to Google rule:

Sections in public, protected and private order, each indented one space.

How to mute this warning if I want to change IdentWidth to 4. Any help is appreciated.

0

There are 0 best solutions below