Menu

How to elevate a specific style error in cppcheck

2020-02-26
2020-02-27
  • Philipp Hasper

    Philipp Hasper - 2020-02-26

    (I copied my question from https://stackoverflow.com/questions/60395271/ to have it in a place more suitable for feature discussions)

    I use cppcheck via the CLI in a continuous integration test parcours. If cppcheck fails, my job fails. Thus, I am limiting the issues cppcheck tests in order to not halt the development completely.

    More specifically, I currently use --enable=missingInclude,warning together with some --suppress.

    How can I elevate specific, non-error and non-warning issue to let cppcheck fail, e.g. missingOverride, which is of the category "style" ?

    • --enable=missingOverride does not seem to work as enable only accepts error|warning|style|performance|portability|information|all
    • --enable=style is also no option because then I have way too many aspects to take care of to get my CI running again instead of fixing them iteratively
    • --enable=styleand then suppress everything else via --suppressions-list= also is problematic, as a new cppcheck version might have new check ids
     

    Last edit: Philipp Hasper 2020-02-26
  • Daniel Marjamäki

    The procedure you can use right now would be to add --enable=style and then suppress the warnings that you do not like. Are there lots of messages you do not like?

    If you want to add something like --enable=missingOverride then well I think that technically that is OK. Feel free to add a github pull request.

    If we would try to limit it so that each check will only be executed if it's enabled then I think it will be a lot of work for very little gain (cppcheck spends far more cpu time parsing the code and performing value flow analysis etc than on running checks). So I suggest that we filter the output; if --enable=missingOverride is given then all checks will be executed and the results will be filtered so no stylistic messages except missingOverride are shown.

     
  • Philipp Hasper

    Philipp Hasper - 2020-02-27

    @danielmarjamaki Yes, basically I want to suppress all but this one.

    Okay, concerning the Github pull requests that's a good way to go however I am uncertain how complex the dev environment will turn out to be. I will see if I find some time for that.

     

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.