Skip to content
Benoît Garçon edited this page Feb 11, 2020 · 12 revisions

Build Status SonarQube Quality Gate SonarQube Bugs SonarQube Coverage SonarQube Technical Debt

Welcome to the sonar-icode-cnes-plugin wiki!

Table of contents

About

Sonar-icode-cnes-plugin is a SonarQube plugin integrating i-Code CNES results into SonarQube dashboard. i-Code CNES is a free open source code checker for Fortran and Shell, available here: https://github.com/lequal/i-CodeCNES.

Build

Required : git, Java 8 and maven 3.5.0 (or latest)

  • Clone github repository : git clone https://github.com/lequal/sonar-icode-cnes-plugin.git
  • Build using maven from the project directory : mvn clean install
  • The generated plugin can be found into the target directory (<sonar-icode-cnes-plugin_dir>/target)

Install

  • Copy the generated jar into <SonarQube_installation_directory>/extensions/plugins.
  • Restart SonarQube: sonar restart or service sonar restart
  • Check SonarQube logs: tail -f <SonarQube_installation_directory>/logs/web.log

Configure

  • Open SonarQube web interfaces http://<SonarQube_installation_host_ip>:9000 or http://localhost:9000 if your are on the host machine.
  • Select "Sonar way" profile and add wanted i-Code CNES rules to it.
  • There are three built-in quality profiles:
    • Sonar way [Fortran 77]
    • Sonar way [Fortran 90]
    • Sonar way [Shell]
  • There are four customizable properties:
Key Description Default value
sonar.icode.reports.path Path to the i-Code reports. Multiple paths can be provided. result.res
sonar.icode.f77.file.suffixes List of suffixes for Fortran 77 files to analyze. Use a coma-separated list of extension. .f,.f77,.for,.fpp,.ftn,.F,.F77,.FOR,.FPP,.FTN
sonar.icode.f90.file.suffixes List of suffixes for Fortran 90 files to analyze. Use a coma-separated list of extension. .f90,.F90
sonar.icode.shell.file.suffixes List of suffixes for Shell files to analyze. Use a coma-separated list of extension. .sh,.ksh,.bash

Run

Prepare i-Code CNES project

For all project source files, run: icode <source_file> > <result_file>

Where:

  • The source file <source_file> shall have for extension what is defined in plugin's properties.
  • The i-Code CNES standard output stream shall be stored into a report file whose name is given in SonarQube property sonar.icode.reports.path.

Configure sonar-scanner

In your project directory, create sonar-project.properties file, containing the following items :

sonar.projectKey=<your_project_key>
sonar.projectName=<your_project_name>
sonar.projectVersion= <your_project_version>
# Comma-separated paths to directories with sources (required)
sonar.sources=.
# Tells SonarQube where the i-Code CNES analysis reports are
sonar.icode.reports.path=<report_path>
# Encoding of the source files
sonar.sourceEncoding=UTF-8

Run sonar-scanner

Once you got i-Code CNES results and sonar-project.properties configured, you can launch sonar-scanner from your project's directory : sonar-scanner.

i-Code CNES plugin rules definition

sonar-icode-cnes-plugin integrates all i-Code CNES rules. For more information on rules definition, please look directly on i-Code CNES github page : https://github.com/lequal/i-CodeCNES.

Contribute

You can contribute to sonar-icode-cnes-plugin :

Support

Contact : L-lequal@cnes.fr

Bugs and Feature requests : https://github.com/lequal/sonar-icode-cnes-plugin/issues

Licensing

sonar-icode-cnes-plugin is under GNU GPL v3.