PricingDownload
Product

Platform

All features44 capabilities, from IDE to CICompliance KitsISO 26262, DO-178C, IEC 62304...AI GovernanceControl AI-generated C/C++ codeWhat’s new in 2027Latest version highlightsScreenshotsSee the product in action

Analyze & improve

Coding standardsMISRA, CERT, CWE, AUTOSARArchitecture & dependenciesGraphs, matrix, cyclesTechnical debtMeasured in hours and dollarsQuality gatesStop regressions in CISmart Code CityYour codebase in 3D

Integrations

IDE pluginsVisual Studio, VS Code, CLion...CI/CD pipelinesJenkins, Azure DevOps, GitHub, GitLabSonarQube pluginC/C++ results in SonarQubeExternal analyzersClang-Tidy, Cppcheck, coverageFeature on Demand
Solutions

By need

Functional safetyCompliance kits per standardCoding standardsMISRA, CERT, AUTOSAR, ISO...Legacy modernizationRefactor large C/C++ safelyCode auditExpert review of your codebaseM&A due diligenceAssess technical health fast

By role

DevelopersSoftware architectsTech leadsDevOps engineersEngineering managersProject managers

CTOsCIOs / IT leadersQA engineersSecurity leadersComplianceConsultantsRequest a guided PoC
Industries

Safety-critical

AutomotiveISO 26262, MISRA, AUTOSARAerospace & DefenseDO-178C programsMedical DevicesIEC 62304 softwareEnergy & UtilitiesIEC 61508 systemsEmbedded SystemsFirmware and devices

Enterprise

Financial ServicesTrading and paymentsGame DevelopmentEngines and large C++Software VendorsCommercial C/C++ productsGovernmentAgencies and contractorsAll industries & case studies
Resources

Learn

DocumentationGuides, rules and CI setupKnowledge baseFrequently asked questionsBlogC and C++ code quality articlesRelease notesEvery version since 2009

Customers

Case studiesSuccess storiesTestimonialsWhat users sayOur customersCompanies using CppDependGold Code QualityOpen source projects we rate

Programs & company

Feature on DemandMissing features built for freeFree for open sourceLicenses for OSS and studentsContact usSales and supportEULALicense agreement
Docs
Documentation

CI/CD Integration

SonarQube Community Integration

5 min readCI/CD IntegrationCppDepend 2027

Enhance Your C/C++ Code Quality with SonarQube and CppDepend Integration

In today's competitive software development landscape, ensuring code quality and maintainability is essential for any project's success. Integrating SonarQube Community Edition with CppDepend offers developers a powerful, combined solution for seamless code analysis.

In this guide, we'll walk you through the process of integrating these two powerful tools, allowing you to maximize your project's code quality and maintainability while minimizing technical debt. Discover how this integration can revolutionize your development process and set your project up for success.

IMPORTANT:

Before using CppDepend on a computer, you must first activate your SonarQube license or begin your evaluation period. To achieve this, simply unzip the CppDepend files on the computer and launch VisualCppDepend.exe once. If your machine is connected to the internet, you'll undergo a brief activation process.

In case your machine lacks internet connectivity, an alternative offline activation procedure will be offered. This step is mandatory for operating the SonarQube CppDepend plugin.

Please note that the CppDepend SonarQube plugin is compatible with SonarQube versions 5.6 and above.

Plugin Prerequisites

IMPORTANT: If for C++ no existing extension is already installed, please consult the documentation for the SonarQube Standalone Integration.

Install the CppDepend extension

CppDepend provides the SonarQube extensions in $InstallDir/Integrations/SonarQube

  • In case of Java Copy the sonar-jarchitect-plugin-1.0.jar
  • In case of C++ SonarQube extension Copy the sonar-cxx-cppdepend-sqplugin.jar
  • In case of SonarQube community version 2 and above Copy the sonar-cxx-cppdepend-community-2.jar
  • And in case of SonarQube community version 1 Copy the sonar-cxx-cppdepend-community-1.jar
  • from the $CppDependInstallDir$\Integrations\SonarQube directory
  • to the $SonarQubeInstallDir$\extensions\plugins directory
  • Restart the SonarQube server for it to take account of the CppDepend plugin.

Configure the CppDepend plugin

In the SonarQube user interface, go to Administration. You need to be logged with the appropriate administrator privileges for that.

SonarQube Administration
  • MANDATORY Specify the full path of the CppDepend SonarQube rules scanner. For Windows it's CppDepend.SonarQube.RuleRunner.exe (windows), CppDepend.SonarQube.RuleRunner (linux, macos) from the $CppDependInstallPath$\Libs directory. Don't prefix the path with an environnement variable path, write the entire absolute path (follow this advice for all paths writing you'll find in this documentation).
  • OPTIONAL Specify the CppDepend project file path (.cdproj extension) to fetch the rules from. If it's not specified the default CppDepend rule set will be used.
    If you specify the CppDepend project file path, the rules taken account are activated rules defined in:
    • The CppDepend project file,
    • Rules defined in the CppDepend Rules Files referenced by the CppDepend project file

Activate the CppDepend Rules in the Sonar server

The CppDepend rules are now loaded in the SonarQube repository but not activated yet. To activate them, you have to:

  • Log as admin in the SonarQube UI
  • Go to the Quality Profiles tab
  • Create a custom Quality Profile. If you already have a custom Quality Profile you can skip this step.Quality Profiles
  • Make sure that you choose the Sonar way profile as parent of your new Quality Profile:Sonar way parent profile
  • After the creation of the custom Quality Profile, you have to add the CppDepend rules. For that click on the Activate More button:Activate More button
  • Choose the CppDepend repository, and click on the Bulk Change button and activate all the CppDepend rules in your new Quality Profile:Bulk Change CppDepend rules
  • Finally go back to the Quality Profile tab and set the new Quality Profile as Default:Set Default Quality Profile

Activate the CppDepend Rules (before SonarQube v6.X)

  • Log as admin in the SonarQube UI
  • Go to the Rules tab
  • Choose Language C++ and Repository: CppDependRules tab CppDepend
  • Activate these rules in the profile you want by clicking on Bulk Change - Activate In:Bulk Change Activate

IMPORTANT:

Notice that the handle of a rule is the rule name with also the parent group(s) names and the rule source code. This remark is important in this situation when:

  • The CppDepend project used for analysis contains a custom rule-set
  • The CppDepend project specified in the SonarQube configuration to define the rules in the SonarQube system (parameter CppDepend rules from cdproj, see the previous section) is different from the CppDepend project used for analysis.

In such situation if the two rules-set don't correspond exactly, the rules won't be resolved in the SonarQube system and the issues won't be computed.

If some rules have been added or removed in your custom rule-set:

  1. Restart the SonarQube server to let it parse the CppDepend project specified in the SonarQube configuration to define the rules
  2. Go again in the Rules tab logged as administrator, to activate/deactivate these new/removed rules through eventually a Bulk Change action.

Run Sonar-Scanner

Here is the SonarQube documentation concerning running Sonar-Scanner from the command line argument.

The cppdepend project file parameter is mandatory -D sonar.cpp.cppdepend.projectPath={'{'}the path of cdproj{'}'}.

>sonar-scanner -D sonar.cpp.cppdepend.projectPath={the path of cdproj}

You can also specify the CppDepend scanner from the command line if it's not done in the SonarQube extension config

C/C++ on Windows

>sonar-scanner -Dsonar.cpp.cppdepend.projectPath={the path of cdproj} -Dsonar.cpp.cppdepend.ruleRunnerPath={CppDependInstallDir\Libs\CppDepend.SonarQube.RuleRunner.exe}

C/C++ on Linux/MacOS

>sonar-scanner -Dsonar.cpp.cppdepend.projectPath={the path of cdproj} -Dsonar.cpp.cppdepend.ruleRunnerPath={CppDependInstallDir/libs/CppDepend.SonarQube.RuleRunner}

Java on Windows

>sonar-scanner -Dsonar.java.jarchitect.projectPath={the path of jdproj} -Dsonar.java.jarchitect.ruleRunnerPath={CppInstallDir\Libs\JArchitect.SonarQube.RuleRunner.exe}

Java on Linux/MacOS

>sonar-scanner -Dsonar.java.jarchitect.projectPath={the path of jdproj} -Dsonar.java.jarchitect.ruleRunnerPath={CppInstallDir/libs/JArchitect.SonarQube.RuleRunner}

Tip: Don't use any environment variable in paths and if the path contains a space character, surround it with double quotes -Dsonar.cpp.cppdepend.projectPath="C:\work with space\project.cdproj"

Browse CppDepend Rules Issues in the SonarQube UI

  • CppDepend Rules Issues are now reported as any issues in the SonarQube UI.
  • You can browse it, go to source code declaration (in the UI), assign it, change its status...CppDepend issues in SonarQube UI

NOTES:

If some issues are missing in the SonarQube UI:

  • Check that you followed all rules activation steps explained in this document.
  • Then double check that the concerned rule is indeed activated by checking if it emits at least one issue.
  • In such case, if some issues are missing, this is because the source file declaration of their parent types hasn't been found. Typically this happens with types and their members generated by the compiler.
Was this page helpful?
Evaluating CppDepend on a production codebase?Get a guided proof of concept with our static analysis architects.
Request a PoC