C/C++ Plugin for SonarQube



Getting Started with the C\C++ SonarQube Plugin


C/C++ Plugin Prerequisites
Plugin installation and configuration

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

  • 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.


  • You have to log in as an admin and activate the CppDepend rules in the profile you want.



  • Execute $CppDependInstallDir$/SonarRunnerForCppDepend.exe "the .cdproj file to analyze "

    For example: SonarRunnerForCppDepend.exe C:\MyWorkspace\test.cdproj.
    SonarRunnerForCppDepend will analyze the cdproj file using CppDepend and launch the SonarQube Scanner executable to load the results into SonarQube.
    Any other argument passed to the SonarRunnerForCppDepend after the cdproj file argument will be passed to the SonarScanner command.
    For example you can pass the version with this command SonarRunnerForCppDepend.exe C:\MyWorkspace\test.cdproj -Dsonar.projectVersion=3.0

Plugin features

  • Multi Module analysis: a CppDepend project could contain many C/C++ projects.
    After the analysis, CppDepend does not put all the code in the same SonarQube module. However, it creates a multi module sonarqube project to isolate each project into a separate module which makes the code navigation very easy.



  • Issues: CppDepend provides by default more than 250 rules, which you can easily customize completely.
    CppDepend provides a powerful way to compute the technical debt of the issues. The CppDepend technical debt and the issue severity are given to SonarQube.



  • Standard metrics: the plugin calculates all the standard SonarQube metrics.



  • Code duplication: The duplications are detected by the CPD tool embedded in SonarQube.



  • Coverage: The plugin loads the coverage result from Cobertura and Microsoft Visual Studio XML result files.
    However, you have to set the path where the xml coverage files exist.