How to ignore JAVA tests in Coverity Connect analysis results?

I use Coverity to scan my project for security.

What I would like to know is how to exclude any java test (NOTE: both integration and block) from the analysis results that are available after fixing the defect.

I used maven to create the project, and I excluded unit tests using the flag -Dmaven.skip.test=true. Although Coverity tests have not been tested, it still does an integration test.

All integration tests in my project contain the word "Test" in the file names. So I started looking at the filter section available in Coverity. Then I tried regex ( .*(!?(Test).*)$), but that didn't work. It appears that the coverage supports two matching characters ( * and ?- see the figure below), although it does not seem to support negative appearance.

enter image description here

Is there a good way to accomplish this task in a simple and clean way?

+4
source share
1 answer

Since Coverity relies on your Maven build, you can eliminate:

  • compilation and execution of both unit tests (according to the Surefire plan) and integration tests (according to the Failsafe plugin), adding-Dmaven.skip.test=true
  • , -DskipTests
  • -DskipITs

, Maven, Maven , - . pom.xml maven:

<modules>
  <!-- remove 'my-it-module' from this list -->
</modules>
<profiles>
    <profile><id>build-it</id>
        <activation><activeByDefault>true</activeByDefault></activation>
        <modules><module>my-it-module</module></modules>
    </profile>
</profiles>

mvn install -P !build-it

+1

Source: https://habr.com/ru/post/1692524/


All Articles