Search code examples
jenkinsstatic-analysis

Coverity & Jenkins: Howto analyse newly committed code ONLY


I have recently added a new Jenkins job to my automation suite to run coverity analysis on a C++ application. The job uses svn to updade to latest code then uses coverity (cov-build, cov-analyze, and cov-format-errors) and creates a text file of coverity errors. However, the application has been around for a long time and has a lot of coverity errors highlighted. I am looking for a way to run coverity so that it only analyses newly added content?

Does anyone know a way to achieve this?


Solution

  • You can't really do this. Coverity has no idea what is new code and what is not.

    But there is a workaround. First, make run Coverity on your code, then mark ALL Coverity issues as Ignore and Intentional in the CIM server. Then, setup your Coverity Plugin to report only when NEW issues are found.

    Now, when Coverity scans your code after a new code update, if any issues are found that do NOT match the existing baseline of issues, it will trigger a failure. NOTE: the failure will continue to trigger until you either modify code to make the issue disappear, or mark the new issue as other than New.