Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,7 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<!-- The destination file for the code coverage report has to be set to the same value
in the parent pom and in each module pom. Then JaCoCo will add up information in
the same report, so that, it will give the cross-module code coverage. -->
<destFile>${project.basedir}/../target/jacoco-it.exec</destFile>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<sonar.tests>${project.basedir}/target/test-classes</sonar.tests>
</properties>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
<artifactId>app</artifactId>

<name>Java :: JaCoco Multi Modules :: App</name>

<properties>
<sonar.tests>${project.basedir}/target/test-classes</sonar.tests>
<sonar.java.binaries>${project.basedir}/target/classes</sonar.java.binaries>
</properties>
</project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package example;

public class HelloWorld {
public class HelloWorld implements Cloneable {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL Add a "clone()" method to this class. rule


public void coveredByUnitTest() {
System.out.println("coveredByUnitTest1");
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAJOR Replace this usage of System.out or System.err by a logger. rule

Expand All @@ -16,5 +16,16 @@ public void coveredByIntegrationTest() {
public void notCovered() {
System.out.println("notCovered");
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAJOR Replace this usage of System.out or System.err by a logger. rule

}


public void morenotCovered() {
System.out.println("morenotCovered");
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAJOR Replace this usage of System.out or System.err by a logger. rule
MINOR Define a constant instead of duplicating this literal "morenotCovered" 3 times. rule

}

public void morenotCovered2() {
System.out.println("morenotCovered");
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAJOR Replace this usage of System.out or System.err by a logger. rule

}

public void morenotCovered3() {
System.out.println("morenotCovered");
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAJOR Replace this usage of System.out or System.err by a logger. rule

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@
<!-- The destination file for the code coverage report has to be set to the same value
in the parent pom and in each module pom. Then JaCoCo will add up information in
the same report, so that, it will give the cross-module code coverage. -->
<sonar.jacoco.itReportPath>${project.basedir}/../target/jacoco-it.exec</sonar.jacoco.itReportPath>
<sonar.jacoco.reportPath>${user.dir}/target/jacoco.exec</sonar.jacoco.reportPath>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.language>java</sonar.language>
<sonar.host.url>https://sonar.symphony.com</sonar.host.url>
<sonar.analysis.mode>preview</sonar.analysis.mode>
<sonar.github.pullRequest>2</sonar.github.pullRequest>
<sonar.github.repository>marturi/sonar-examples</sonar.github.repository>
<jacoco.out.path>${user.dir}/target</jacoco.out.path>
<jacoco.out.file>jacoco.exec</jacoco.out.file>
</properties>

<dependencies>
Expand Down Expand Up @@ -59,32 +67,27 @@
<pluginManagement>
<plugins>
<plugin>
<configuration>
<destFile>${jacoco.out.path}/${jacoco.out.file}</destFile>
<append>true</append>
</configuration>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
<version>0.7.4.201502262128</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<append>true</append>
</configuration>
<executions>
<execution>
<id>agent-for-ut</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>agent-for-it</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>verify</phase>
Expand Down