SonarQube

From air
Jump to navigation Jump to search


SonarQube® software (previously called Sonar) is an open source quality management platform, dedicated to continuously analyze and measure technical quality, from project portfolio to method. SonarQube platform can be extended by open source and commercial plugins.

https://docs.sonarqube.org/

https://docs.sonarqube.org/display/PLUG/Plugin+Library

SonarQube en 10 minutes top chrono

1) Lancer le container SonarQube

docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube

2) Copier (ou modifier) le fichier suivant dans ~/.m2/settings.xml


<settings>
    <pluginGroups>
        <pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
    </pluginGroups>
    <profiles>
        <profile>
            <id>sonar</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <!-- Optional URL to server. Default value is http://localhost:9000 -->
                <sonar.host.url>
                  http://localhost:9000
                </sonar.host.url>
            </properties>
        </profile>
     </profiles>
</settings>

3) Dans votre projet Maven

cd mon_projet
mvn clean verify sonar:sonar

4) Ouvrir la page des rapports SonarQube http://localhost:9000

Attention: l'accès aux rapports n'est pas sécurisé