Menu

Cppcheck on large code bases

2020-02-27
2020-03-11
  • Robert Killingsworth

    Hi,

    I wish to use cppcheck on a per commit basis on our CI but I'm hitting a few hurdles.
    when using a compile_command.json as the project file I am unable to check indivuidule files covered by the commit it forces the checking of the whole codebase.
    I have tried to cut down the compile_command.json file to only include the files with in the commit but in this instance it finds very few errors including ones given in a rule file which it does find with out the project file. These are scoping errors ect and not ones to do with unused functions.

    Any advice would be very helpful.

     

    Last edit: Robert Killingsworth 2020-02-27
    • versat

      versat - 2020-03-10

      Hmm, I am not aware of such a functionality in Cppcheck itself. I am not sure if only analysing the changed files could miss any errors, so I would always run a full analysis and compare the results.

      What also comes to my mind is using --cppcheck-build-dir=.
      From the help:

      --cppcheck-build-dir=<dir>
                               Analysis output directory. Useful for various data.
                               Some possible usages are; whole program analysis,
                               incremental analysis, distributed analysis.
      

      I am not sure if the incremental analysis that is mentioned here works as you need it.
      Cppcheck stores information about the code in the specified directory (which must exist already IIRC). If you do not delete this content it can be reused during the next analysis.
      Maybe you could give it a try.

       
    • Markus Elfring

      Markus Elfring - 2020-03-11

      How much do you check run time characteristics for advanced source code analyses?

       

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.