- Documentation
- Getting Started
- Analysis and Report
- Code Rule and Query
- Scanyp Features
- Build Process Integration
SonarQube Standalone Integration
IMPORTANT:
|
C/C++ Plugin Prerequisites
- Install SonarQube.
- Install SonarQube Scanner or the old Sonar Runner.
- Add the SonarQube Scanner or the SonarRunner bin directory to the PATH environment variable.
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. - Configure the CppDepend custom rules(Optional):