-
Notifications
You must be signed in to change notification settings - Fork 363
CXX Custom Rules
guwirth edited this page Feb 20, 2021
·
8 revisions
The Java API will be more fully-featured than what's available for XPath, and is generally preferable. However, this comes with the overhead of maintaining a SonarQube plugin (including keeping it up-to-date as APIs change, upgrading the plugin after releasing a new version).
Writing custom rules for C++ is a six-step process:
- Create a new SonarQube plugin.
- Put a dependency on the API of the cxx plugin.
- Create as many custom rules as required.
- Generate the SonarQube plugin (jar file).
- Place this jar file in the
SONARQUBE_HOME/extensions/plugins
directory. - Restart SonarQube server.
The description Plugin Basics is a good starting point for writing your own extensions. In addition, Adding Coding Rules gives further useful hints.
You can use https://github.com/SonarOpenCommunity/cxx-custom-checks-example-plugin as a base for your rules.