hygieia / hygieia-codequality-sonar-collector

Hygieia Collector for Sonar versions 5.x to 8.x
https://github.com/Hygieia/Hygieia/blob/gh-pages/pages/hygieia/collectors/build/sonar.md
Apache License 2.0
4 stars 52 forks source link
codequality hygieia-collector sonar spring-boot

Due to changes in the priorities, this project is currently not being supported. The project is archived as of 6/1/2023 and will be available in a read-only state. Please note, since archival, the project is not maintained or reviewed

Hygieia Collector to collect static code analysis data from Sonar

Build Status Quality Gate Status Total alerts Language grade: Java Maven Central License Gitter Chat

Configure the Sonar Collector to display and analyze information (related to code quality) on the Hygieia Dashboard, from SonarQube (formerly known as Sonar). Hygieia uses Spring Boot to package the collector as an executable JAR file with dependencies.

Table of Contents

Setup Instructions

To configure the Sonar Collector, execute the following steps:

Sample Application Properties File

The sample application.properties file lists parameters with sample values to configure the Sonar Collector. Set the parameters based on your environment setup.

        # Database Name
        dbname=dashboarddb

        # Database HostName - default is localhost
        dbhost=10.0.1.1

        # Database Port - default is 27017
        dbport=27017

        # MongoDB replicaset
        dbreplicaset=[false if you are not using MongoDB replicaset]
        dbhostport=[host1:port1,host2:port2,host3:port3]

        # Database Username - default is blank
        dbusername=dashboarduser

        # Database Password - default is blank
        dbpassword=dbpassword

        # Collector schedule (required)
        sonar.cron=0 0/5 * * * *

        # Sonar server(s) (required) - Can provide multiple
        sonar.servers[0]=http://sonar.company.com

        # Sonar version, match array index to the server. If not set, will default to version prior to 6.3.
        sonar.versions[0]=6.31

        # Sonar Metrics - Required. 
        #Sonar versions lesser than 6.3

        # Sonar tokens to connect to authenticated url 
        sonar.tokens[0]=<api token>
        sonar.metrics[0]=ncloc,line_coverage,violations,critical_violations,major_violations,blocker_violations,violations_density,sqale_index,test_success_density,test_failures,test_errors,tests

        # For Sonar version 6.3 and above
        sonar.metrics[0]=ncloc,violations,new_vulnerabilities,critical_violations,major_violations,blocker_violations,tests,test_success_density,test_errors,test_failures,coverage,line_coverage,sqale_index,alert_status,quality_gate_details

        # Sonar login credentials
        # Format: username1,username2,username3,etc.
        sonar.usernames= 
        # Format: password1,password2,password3,etc.
                sonar.passwords=

Run collector with Docker

You can install Hygieia by using a docker image from docker hub. This section gives detailed instructions on how to download and run with Docker.