Skip to content
This repository was archived by the owner on Jan 21, 2023. It is now read-only.

mariamihai/codequality-related

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Code Quality related tools

SonarQube

Adding SonarQube with Docker

Get the latest community edition and create a container based on it:

docker pull sonarqube
docker run -d --name sonarqube -p 9000:9000 sonarqube
docker run --stop-timeout 3600 sonarqube

Using Sonar with a database (not In Memory)

link

Trigger Sonar

mvn sonar:sonar \
  -Dsonar.projectKey=org.example:codequality \
  -Dsonar.host.url=http://localhost:9000 \
  -Dsonar.login=$SONAR_TOKEN

JaCoCo

Maven Plugin

</plugins>
	<plugin>
		<groupId>org.jacoco</groupId>
		<artifactId>jacoco-maven-plugin</artifactId>
		<version>0.7.7.201606060606</version>
		<executions>
			<execution>
				<goals>
					<goal>prepare-agent</goal>
				</goals>
			</execution>
			<execution>
				<id>report</id>
				<phase>test</phase>
				<goals>
					<goal>report</goal>
				</goals>
			</execution>
		</executions>
	</plugin>
</plugins>

Trigger JaCoCo independent of Sonar

Based on the previous configuration, JaCoCo will trigger with the test goal.

mvn clean test

View report at ‘target/site/jacoco/index.html’

Trigger JaCoCo and then Sonar

mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install -Dmaven.test.failure.ignore=true

mvn sonar:sonar \
  -Dsonar.projectKey=org.example:codequality \
  -Dsonar.host.url=http://localhost:9000 \
  -Dsonar.login=$SONAR_TOKEN

Important!

Make sure each test starts with "test" otherwise JaCoCo will ignore it.

Pitest

Trigger Pitest and then Sonar

mvn org.pitest:pitest-maven:mutationCoverage

mvn sonar:sonar -Dsonar.pitest.mode=reuseReport

View report at ‘target/site/pit-reports/index.html’

Links

SonarScanner for Maven

Integrate SonarQube with Maven

SonarQube - Baeldung

Johan Janssen at Jfokus

JaCoCo - Baeldung

PiTest Quickstart

About

Small project including SonarQube, JaCoCo, etc.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages