Is there a style checker for c++?

前端 未结 3 847
终归单人心
终归单人心 2021-02-03 14:21

I have worked with java for a while now, and I found checkstyle to be very useful. I am starting to work with c++ and I was wondering if there is a style checker with similar fu

相关标签:
3条回答
  • 2021-02-03 14:24

    I have had good feedback about Artistic Style which allows to apply a uniform style on code without too much hassle.

    It's free and there are plenty of "classic" styles already defined. It might not work with C++0x new constructs though.

    I am also expecting a Clang library, though I haven't found any to date. Normally, given Clang's structure it should be relatively easy, but then it's always easier to say than to code and I guess nobody took the time yet.

    0 讨论(0)
  • 2021-02-03 14:37

    What about Vera++ ?

    Vera++ is a programmable tool for verification, analysis and transformation of C++ source code. Vera++ is mainly an engine that parses C++ source files and presents the result of this parsing to scripts in the form of various collections - the scripts are actually performing the requested tasks.

    Click here to see a more complete demo of what it can do.

    crc.hpp:157: keyword 'explicit' not followed by a single space
    crc.hpp:588: closing curly bracket not in the same line or column
    dynamic_property_map.hpp:82: keyword 'if' not followed by a single space
    functional.hpp:106: line is longer than 100 characters
    multi_index_container.hpp:472: comma should be followed by whitespace
    version.hpp:37: too many consecutive empty lines
    weak_ptr.hpp:108: keyword 'catch' not followed by a single space
    ...
    
    0 讨论(0)
  • 2021-02-03 14:46

    KWStyle seems to be a lightweight fit

    0 讨论(0)
提交回复
热议问题