0

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.

4

1 回答 1

0

好吧,也许我在最后一个答案中不够清楚,或者您没有仔细阅读它。这是另一个尝试。

Uncrustify 具有间距对齐功能。在间距函数之后应用对齐函数(至少在尾随注释的情况下)。

如果您align_right_cmt_span设置为大于零,则对齐功能将应用于尾随注释。 该选项align_right_cmt_gap已启用,即使它设置为零,默认情况下也是如此,即使您指定它也是如此。似乎它现在只有在不为零时才处于活动状态。除了该问题,您已align_right_cmt_at_col设置为 1。

我没有使用 CPPlint、atom-beautify 或 google 样式指南。因此,如果您需要帮助,请上传一些代码示例:输入代码、输出代码、预期代码。

于 2017-04-11T12:33:21.327 回答