SonarQube Standalone Integration


IMPORTANT:
  • This documentation concern the full C/C++ SonarQube integration. In this case no need to install any SonarQube C++ plugin to parse your source code.
    However, it's highly recommended to use the CppDepend plugin side by side with the C++ community plugin. For that you can refer to this documentation .
  • To run CppDepend on a machine you need first to activate your licensing or your evaluation period.
    To do so, once CppDepend files unzipped on the machine, just run once VisualCppDepend.exe. You'll go through a few seconds activation procedure if the machine is connected to internet.
    If the machine is not connected to internet, an offline activation procedure will be proposed instead, and must be fulfilled in order to run the SonarQube CppDepend plugin.
  • The CppDepend SonarQube plugin supports SonarQube version 5.6 and higher.

C/C++ Plugin Prerequisites
Plugin installation and configuration

  • Install the plugin:
    Copy the sonar-cxx-plugin-cppdepend-1.0.jar from $CppDependInstallDir$/SonarPlugin to the $SonarQubeInstallDir$\extensions\plugins directory and restart SonarQube.

  • Configure the CppDepend scanner path(Mandatory):
    The SonarQube scanner is mandatory to parse the source code using the CppDepend parser based on Clang.

    In case of Windows you have to reference the CppDepend.SonarQubeScanner.exe path, and for linux you have to reference the SonarQubeScanner.sh path.


  • Configure the CppDepend custom rules(Optional):
    The default CppDepend rules are loaded to the SonarQube rules repository. However, if you need to customize these rules you can define your own custom rules using the .cdproj file path located under the SonarQube Administration Tab.


  • Create a CppDepend project from VisualCppDepend:
    Create a CppDepend Project as described in our Getting Started page. Launch the analysis from VisualCppDepend to validate that your projects are parsed.

  • Launch the analysis from the sonar scanner:
    For this step you can follow the Sonar-Scanner documentation, you need to create your sonar-project.properties in your root project folder. Here's a basic content of this file:
    sonar.projectKey=myProject
    sonar.projectName=My Project
    sonar.projectVersion=1.1
    sonar.sources=.
    

    Finally go to your project root folder where you have copied the sonar-project.properties file and execute:
    >sonar-scanner  -D sonar.cpp.cppdepend.projectPath={the path of cdproj}  
        
    The sonar.cpp.cppdepend.projectPath parameter is mandatory, it's the path of the cdproj created in the previous step.

CppDepend offers a wide range of features. It is often described as a Swiss Army Knife for C and C++ developers.

Start Free Trial
.