C/C++ Plugin for SonarQube

C/C++ Plugin Prerequisites
Plugin installation and configuration

  • Copy the sonar-cxx-plugin-cppdepend-1.0 from $CppDependInstallDir$/SonarPlugin 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 from the SonarQube Administration tab your .cdproj file containing your custom rules.

  • Now you have to log as 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 contians many C/C++ projects
    After the analysis CppDepend does not put all the code in the same SonarQube module. However it create 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 completely customize easily.
    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 calculate all the standard SonarQube metrics.

  • Code duplication: The duplicaions are detected by the CPD tool embeded in SonarQube.

  • Coverage: The plugin load 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.