Menu

can cppcheck check coding style?

wuyuexyz
2015-04-06
2015-04-22
  • wuyuexyz

    wuyuexyz - 2015-04-06

    I'm new in cppcheck. I just want to use it to check some coding style issue, for example,
    a=b+c; // bad style and should give an message
    a = b + c; // good style
    can I enable cppcheck to do such check?

     
  • Alexander Mai

    Alexander Mai - 2015-04-06

    There are some style checks in cppcheck, but its focus is certainly not on formatting issues.
    I suggest to check out explicit coding style checkers, e.g. http://code.google.com/p/nsiqcppstyle/ (or maybe don't even check but try code formatters like astyle)

     
    • wuyuexyz

      wuyuexyz - 2015-04-09

      thanks

       
  • olivier barthelemy

    And even though you could add new checks as regexps, your example could not be detected, since checks are run after cppcheck has preprocessed the code, and put it's own spacing rules

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.