-
Notifications
You must be signed in to change notification settings - Fork 364
Supported configuration properties
This description is only valid for cxx plugin version 1.x
The cxx plugin uses the following properties during analysis. See here for the ways how to pass them to the cxx plugin.
Beside the general SonarQube Analysis Parameters the latest released cxx plugin supports the parameter below:
- sonar.cxx.suffixes.sources
- sonar.cxx.suffixes.headers
- sonar.cxx.includeDirectories
- sonar.cxx.forceIncludes
- sonar.cxx.defines
- sonar.cxx.cFilesPatterns
- sonar.cxx.errorRecoveryEnabled
- sonar.cxx.cpd.ignoreLiterals
- sonar.cxx.cpd.ignoreIdentifiers
- sonar.cxx.cppcheck.reportPath
- sonar.cxx.rats.reportPath
- sonar.cxx.valgrind.reportPath
- sonar.cxx.vera.reportPath
- sonar.cxx.drmemory.reportPath
- sonar.cxx.xunit.reportPath
- sonar.cxx.xunit.xsltURL
- sonar.cxx.xunit.provideDetails
- sonar.cxx.vstest.reportsPaths
- sonar.cxx.nunit.reportsPaths
- sonar.cxx.xunit.reportsPaths
- sonar.cxx.pclint.reportPath
- sonar.cxx.other.reportPath
- sonar.cxx.other.sqales
- sonar.cxx.coverage.reportPath
- sonar.cxx.coverage.itReportPath
- sonar.cxx.coverage.overallReportPath
- sonar.cxx.coverage.forceZeroCoverage
- sonar.cxx.compiler.parser
- sonar.cxx.compiler.reportPath
- sonar.cxx.compiler.regex
- sonar.cxx.compiler.charset
- sonar.cxx.vc.reportPath
- sonar.cxx.vc.regex
- sonar.cxx.vc.charset
- sonar.cxx.gcc.reportPath
- sonar.cxx.gcc.regex
- sonar.cxx.gcc.charset
- sonar.cxx.msbuild.reportPath
- sonar.cxx.msbuild.charset
- sonar.cxx.jsonCompilationDatabase
- sonar.cxx.scanOnlySpecifiedSources
- sonar.cxx.clangsa.reportPath
- sonar.cxx.funccomplexity.threshold
- sonar.cxx.funcsize.threshold
Scope: system, project
Default: .cxx,.cpp,.cc,.c
Comma separated list of file name extensions to be considered as C++ source files during analysis.
Example:
Scope: system, project
Default: .hxx,.hpp,.hh,.h
Comma separated list of file name extensions to be considered as C++ header files during analysis.
Example:
Scope: system, project
Default: ---
Comma separated list of directories where the cxx plugin will be looking for included files.
- Note: the cxx plugin doesn't know any standard include paths. If they should be used, configure them manually using this property.
*Example:* `include, /usr/include`
Scope: system, project
Default: ---
Comma separated list of header files to be implicitly included at the beginning of each source file, for details see Force Include
Example: VS10Macros.h
Scope: system, project
Default: ---
List of macros which should be used during analysis. The syntax is the same the body of #define-directives, except the #define keyword itself. This is a multiline property, which means:
- If you're using SonarQube's UI just write a macro per line
- When setting via .properties-file separate macros using
\n\
*Example:*
va_arg(a, b) 0, \n\ PRIx64 "" \n\ DEBUG 1
Scope: project
Default: *.c,*.C
Comma-separated list of wildcard patterns used to detect C files. When
a file matches any of the patterns, it is parsed in C-compatibility mode.
Example:
Scope: project, module
Default: True
Defines tolerant or strict error handling mode. This setting has impact on parsing the source files and reading report files:
- report files:
- error in an report file could be for example invalid file references or line numbers
- in tolerant mode (
True
) analysis continue in case of errors in a report file - in strict mode (
False
) an error in a report file will stop the analysis - source code parsing:
- parsing error means that source code file does not fit to C/C++ grammar
- in tolerant mode (
True
) syntax errors within a declaration are skipped, analysis is continued with next declaration in source code file. For details see Error Recovery. - in strict mode (
False
) analysis of source code file fails after an syntax error. Source code file is ignored.
*Example:* `sonar.cxx.errorRecoveryEnabled=True`
Scope: project, module
Default: False
CPD ignores literal value differences when evaluating a duplicate block. This means that foo=42; and foo=43; will be seen as equivalent.
Example: sonar.cxx.cpd.ignoreLiterals=False
Scope: project, module
Default: False
CPD ignores identifier value differences when evaluating a duplicate block.; i.e., variable names, methods names, and so forth.
Example: sonar.cxx.cpd.ignoreIdentifiers=True
Scope: project
Default: ---
Ant pattern describing the path to Cppcheck reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: ---
Ant pattern describing the path to RATS reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: ---
Ant pattern describing the path to Valgrind reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: ---
Ant pattern describing the path to Vera++ reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: ---
Ant pattern describing the path to Dr Memory reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: ---
Ant pattern describing the path to unit test execution reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: ---
A name of a built in XSLT-file or an URL to an external one. Available builtins:
- boosttest-1.x-to-junit-1.0.xsl: For transforming Boost-reports
- boosttest-1.x-to-junit-dummy-1.0.xsl: For transforming Boost-reports, simulating virtual files
- cpptestunit-1.x-to-junit-1.0.xsl: For transforming CppTestUnit-reports
- cppunit-1.x-to-junit-1.0.xsl: For transforming CppUnit-reports
*Example*: `cppunit-1.x-to-junit-1.0.xsl`
Scope: project
Default: False
History: no more supported with v0.9.7+
If "True", tries to assign testcases in reports to test resources in SonarQube,
thus making the drilldown to details possible
Example:
Scope: project
Default: ---
Ant pattern describing the path to unit test execution reports. TRX output from VSTest. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: ---
Ant pattern describing the path to unit test execution reports. XML output from the NUnit console runner. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: ---
Ant pattern describing the path to unit test execution reports (XUnit XML output). Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: ---
Ant pattern describing the path to PC-lint reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: ---
Ant pattern describing the path to other reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: ---
History: no more supported with v0.9.6+
SQALE characteristics for 'external' code analysers. Ant pattern describing the path to SQALE characteristics, relative to projects root.
Example:
Scope: project
Default: ---
Ant pattern describing the path of unit test coverage reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: ---
History: no more supported with v0.9.9+ (or SQ6.2+)
Ant pattern describing the path of integration test coverage reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: ---
History: no more supported with v0.9.9+ (or SQ6.2+)
Ant pattern describing the path of overall test coverage reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: True
History: no more supported with v0.9.9+ (or SQ6.2+)
If 'True', source files without coverage report results are set to zero coverage. This results in more realistic overall Technical Debt values. This setting is only enabled if one ore more of the keys sonar.cxx.coverage.reportPath
, sonar.cxx.coverage.itReportPath
or sonar.cxx.coverage.overallReportPath
is defined (e.g. sonar.cxx.coverage.forceZeroCoverage
and sonar.cxx.coverage.reportPath
for line coverage). In case you have no report you have to assign a dummy report.
Example:
Scope: project
Default: Visual C++
History: no more supported with v1.2.0+
The format of the warnings file. Currently supported are 'Visual C++' and 'GCC'.
Example:
Scope: project
Default: ---
History: no more supported with v1.2.0+
Ant pattern describing the path to compiler output file. Path can be relative or absolute. Single path or comma separated list of paths is supported.
The current default settings can be used for VC++ compiler log file. If available compiler macros and includes will be taken also from build log and used during the pre processing of sources. See Compilers
Example:
Scope: project
Default: ^.*[\\\\,/](.*)\\(([0-9]+)\\)\\x20:\\x20warning\\x20(C\\d\\d\\d\\d):(.*)$
History: no more supported with v1.2.0+
Regular expression for four groups with this sequence:
- file name
- line number
- message id
- message text
*Example:*
Scope: project
Default: UTF-16
History: no more supported with v1.2.0+
Charset used for the compiler log file (sonar.cxx.compiler.reportPath
) e.g. UTF-8, UTF-16 (for more see java.nio.charset.Charset)
Example:
Scope: project
Default: ---
Ant pattern describing the path to compiler output file. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: (.*>)?(?<file>.*)\\((?<line>\\d+)\\)\\x20:\\x20warning\\x20(?<id>C\\d+):(?<message>.*)
Regex must define the named groups <file>, <line>, <id>, <message>
.
*Example:*
Scope: project
Default: UTF-8
Charset used for the compiler log file (sonar.cxx.vc.reportPath
) e.g. UTF-8, UTF-16 (for more see java.nio.charset.Charset)
Example:
Scope: project
Default: ---
Ant pattern describing the path to compiler output file. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Example:
Scope: project
Default: (?<file>.*):(?<line>[0-9]+):[0-9]+:\\x20warning:\\x20(?<message>.*)\\x20\\[(?<id>.*)\\]
Regex must define the named groups <file>, <line>, <id>, <message>
.
Example:
Scope: project
Default: UTF-8
Charset used for the compiler log file (sonar.cxx.gcc.reportPath
) e.g. UTF-8, UTF-16 (for more see java.nio.charset.Charset)
Example:
Scope: project
Default: ---
Ant pattern describing the path to MSBuild output file. Path can be relative or absolute. Single path or comma separated list of paths is supported. If available compiler macros and includes will be taken also from build log and used during the preprocessing of source files (see Compilers).
Example:
Scope: project
Default: UTF-8
Charset used for the MSBuild log file (sonar.cxx.msbuild.reportPath
) e.g. UTF-8, UTF-16 (for more see java.nio.charset.Charset)
Example:
Scope: project
Default: ---
Enable CXX analysis to utilize JSON compilation database support. Specifies file to be used as JSON compilation database. JSON compilation database is used to improve C++ symbol and include directory knowledge. cxx plugin also supports extension to allow importing of used compiler's internal symbols and includes.
For more information please see: JSON compilation database format specification support
Example:
Scope: project
Default: False
History: no more supported with v1.0.0+
When using JSON compilation database support limit cxx plugin analysis to specified files in JSON compilation database. This setting can be used to limit analysis to only compiled files.
Example:
Scope: project
Default: ---
Ant pattern describing the path to Clang Static Analyzer plist reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
Examples:
sonar.cxx.clangsa.reportPath=divzero.plist
or
sonar.cxx.clangsa.reportPath=analyzer_reports/*/*.plist
Scope: project
Default: 10
Cyclomatic complexity threshold used to classify a function as complex. The threshold is for the metrics:
- Complex Functions: Number of functions with high cyclomatic complexity
- Complex Functions (%): % of functions with high cyclomatic complexity
- Complex Functions Lines of Code: Number of lines of code in functions with high cyclomatic complexity
- Complex Functions Lines of Code (%): % of lines of code in functions with high cyclomatic complexity
Scope: project
Default: 20
Function size threshold to consider a function to be too big. The threshold is for the metrics:
- Big Functions: Number of functions with too many lines
- Big Functions Lines of Code: Number of lines of code in functions with too many lines
- Big Functions (%): Number of lines of code in functions with too many lines
- Big Functions Lines of Code (%): % of lines of code in functions with too many lines
Hints V1.3.0:
- no changes
Hints V1.2.1:
- no changes
Hints V1.2.0:
- GCC and MSVC compiler sensor can be used at the same time now
-
BREAKING CHANGE :
sonar.cxx.compiler
settings are no more supported!- use
sonar.cxx.vc
to read MSVC reports - use
sonar.cxx.gcc
to read GCC reports - use
sonar.cxx.msbuild
to read includes and defines from MSBuild log file
- use
-
BREAKING CHANGE :
- Setting
sonar.cxx.missingIncludeWarnings
is no more available. Turn debug info on to get information. - Usage of C plugin in parallel.
- Please keep in mind that the C plugin is still experimental.
- You can use all CXX configuration properties also for the C plugin: use
sonar.c.xxx
instead ofsonar.cxx.xxx
- You have to set specific (different) file extensions in
sonar.cxx.suffixes.sources
andsonar.c.suffixes.sources
. - Set
sonar.cxx.cFilesPatterns
in the C plugin configuration (but not in the cxx plugin configuration).
- Json compilation database support
sonar.cxx.jsonCompilationDatabase
is experimental only
Hints V1.1.0:
- Usage of C plugin in parallel.
- Please keep in mind that the C plugin is still experimental.
- You can use all CXX configuration properties also for the C plugin: use
sonar.c.xxx
instead ofsonar.cxx.xxx
- You have to set specific file extensions in
sonar.cxx.suffixes.sources
andsonar.c.suffixes.sources
. -
sonar.cxx.cFilesPatterns
should be set in the C plugin configuration but not in the cxx plugin configuration.
- Json compilation database support
sonar.cxx.jsonCompilationDatabase
is also experimental only-
sonar.cxx.scanOnlySpecifiedSources
is no more supported. There were conflicts withsonar.sources
andsonar.tests
.
-
- new configuration properties:
sonar.cxx.funccomplexity.threshold
andsonar.cxx.funcsize.threshold
Hints V1.0.0:
- Usage of C plugin in parallel.
- Please keep in mind that the C plugin is still experimental.
- You can use all CXX configuration properties also for the C plugin: use
sonar.c.xxx
instead ofsonar.cxx.xxx
- You have to set specific file extensions in
sonar.cxx.suffixes.sources
andsonar.c.suffixes.sources
. -
sonar.cxx.cFilesPatterns
should be set in the C plugin configuration but not in the cxx plugin configuration.
- Json compilation database support
sonar.cxx.jsonCompilationDatabase
is also experimental only-
sonar.cxx.scanOnlySpecifiedSources
is no more supported. There were conflicts withsonar.sources
andsonar.tests
.
-
Hints V0.9.9:
- There are some changes in the SQ core API, starting with SQ 6.2:
- The property
sonar.cxx.forceZeroCoverage
is no more supported. There is now a SQ core support basing onEXECUTABLE_LINES_DATA
.
- The property
-
sonar.cxx.coverage.itReportPath
andsonar.cxx.coverage.overallReportPath
are no more supported by the SQ core. There is no replacement available. - Usagage of C plugin in parallel.
- Please keep in mind that the C plugin is still experimental.
- You can use all CXX configuration properties also for the C plugin: use
sonar.c.xxx
instead ofsonar.cxx.xxx
- You have to set specific file extensions in
sonar.cxx.suffixes.sources
. -
sonar.cxx.cFilesPatterns
should be set in the C plugin configuration but not in the cxx plugin configuration.
- Json compilation database support
sonar.cxx.jsonCompilationDatabase
is also experimental only.
Hints V0.9.8:
- Clang Static Analyzer support v5.0.0 (plist reports) available:
sonar.cxx.clangsa.reportPath
. - Clang Tidy support available:
sonar.cxx.clangtidy.reportPath
. - CxxOtherSensor: XSLT pre-analyse support available:
-
sonar.cxx.other.N.inputs
,sonar.cxx.other.N.outputs
,sonar.cxx.other.N.stylesheet
(N=1...9)
-
- There are some changes in the SQ core API, starting with SQ 6.2:
- The property
sonar.cxx.forceZeroCoverage
is no more supported. There is now a SQ core support basing onEXECUTABLE_LINES_DATA
.
- The property
-
sonar.cxx.coverage.itReportPath
andsonar.cxx.coverage.overallReportPath
are no more supported by the SQ core. There is no replacement available. - Usagage of C plugin in parallel.
- Please keep in mind that the C plugin is still experimental.
- You can use all CXX configuration properties also for the C plugin: use
sonar.c.xxx
instead ofsonar.cxx.xxx
- You have to set specific file extensions in
sonar.cxx.suffixes.sources
. -
sonar.cxx.cFilesPatterns
should be set in the C plugin configuration but not in the cxx plugin configuration.
- Json compilation database support
sonar.cxx.jsonCompilationDatabase
is also experimental only.
Hints V0.9.7:
- Improved report handling: there is a tolerant and a strict mode now. In tolerant mode analysis continue in case of errors in a report file. In strict mode an error in a report file will stop the analysis (
sonar.cxx.errorRecoveryEnabled
). In versions before this one behaviour was sometimes strict and sometimes tolerant. - The default value of
sonar.cxx.errorRecoveryEnabled
is True now. To go back to old behaviour set the value to False. -
sonar.cxx.forceZeroCoverage
: better detection of executable lines. Resulting coverage can be slightly different. - Improved CPD algorithm with additional configuration settings
sonar.cxx.cpd.ignoreLiterals
andsonar.cxx.cpd.ignoreIdentifiers
. To get same numbers as before set both toFalse
. -
sonar.cxx.xunit.provideDetails
is no more supported
Hints V0.9.6:
- SQALE quality model is no more supported:
sonar.cxx.other.sqales
- support of new SonarQube Quality Model
- support of Dr Memory reports:
sonar.cxx.drmemory.reportPath
-
sonar.cxx.xunit.reportsPaths
: XUnit over sonar-dotnet-tests-library is supported now
Hints V0.9.5:
-
sonar.cxx.vstest.reportsPaths
: TRX output from VSTest is supported now -
sonar.cxx.nunit.reportsPaths
: XML output from the NUnit console runner is supported now -
reportPath
: path can be relative or absolute now. Paths inside and outside of root folder are supported. -
reportPath
: Single path or comma separated list of paths is supported. - Support of placeholder in configuration file. Format is ${xxx}, supported are environment variables, Java system properties and SonarQube properties.
Hints V0.9.4:
- Default values for
reportPath
values has been removed to get meaningful error messages. In case you were using the defaults you have to explicit define them in thesonar-project.properties
file now. -
forceZeroCoverage
: Depends on which key (sonar.cxx.coverage.reportPath
,sonar.cxx.coverage.itReportPath
,sonar.cxx.coverage.overallReportPath
) is defined in thesonar-project.properties
file now. DefiningforceZeroCoverage
alone will no more work. - EXPERIMENTAL: It is now possible to define SQALE characteristics for external rules (other)
sonar.cxx.other.sqales
.
Hints V0.9.3:
- Starting with this version it is possible to automatically retrieve includes, defines and compiler options from a Visual Studio log file. Create the log file with the option
/v:Diagnostic
and assign it tosonar.cxx.compiler.reportPath
.
Hints V0.9.2:
- New property
sonar.cxx.coverage.forceZeroCoverage
set coverage for source files without coverage report to 0. For V0.9.1 compatibility set value to 'false'. - New property
sonar.cxx.xunit.provideDetails
. To get detailed unit test information set property to 'true'. This is also the V0.9.1 compatibility value. Because SonarQube does not support 'virtual files' any more test resources must be available. - new property
sonar.cxx.cFilesPatterns
Hints V0.9.1:
- Configuration setting
sonar.cxx.cppncss.reportPath
is no longer supported. - Rename configuration setting
sonar.cxx.externalrules.reportPath
tosonar.cxx.other.reportPath
- Rename configuration setting
sonar.cxx.include_directories
tosonar.cxx.includeDirectories
- new property
sonar.cxx.forceIncludes
Hints V0.9.0:
- Use
sonar.cxx.include_directories
instead ofsonar.cxx.includeDirectories