简体   繁体   中英

uncrustify google style c++ config

I am using uncrustify and atom-beautify in atom.io to format my C++ code according to google styling guide. I am using CPPlint to verify whether the code is formatted correctly. I am using the config file from https://gist.githubusercontent.com/philectron/1a1e1ccb06d5643cd61d85fc5ecaf429/raw/8813567b8f7dd49003228e19c3d10719b49995a1/uncrustify-preferences.cfg . But after beautifying, cpplint is reporting the following problems.

  1. "At least two spaces is best between code and comments [whitespace/comments]" is not enforced and I am getting this error in multiple places. The answer for this question at Uncrustify - How do I align trailing comments by two-space gap? is not working.
  2. "protected: should be indented +1 space inside." I am getting the same error for private and public as well.

If this is not the right way, how can I beautify and lint inside atom.io.

Well maybe I wasn't clear enough in the last answer or you haven't read it carefully enough. Here is another try.

Uncrustify has spacing and aligning functions. Aligning functions are applied after the spacing functions (at least in the case of the trailing comments).

If you have align_right_cmt_span set to greater than zero the aligning functions will also be applied on trailing comments. The option align_right_cmt_gap is than enabled, even if it is set to zero, which it is by default even if you do not specify it. It seems that it is now only active if it is not zero. Additionally to that problem you have align_right_cmt_at_col set to 1.

I am not using CPPlint, atom-beautify or the google styling guide. So if you want help, upload some code examples: input code, output code, expected code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM