Skip to content

Supported configuration properties

Günter Wirth edited this page Jun 23, 2016 · 44 revisions

The C++ Community Plugin uses the following properties during analysis. See here for the ways how to pass them to the plugin.

Beside the general SonarQube Analysis Parameters the latest released plugin supports the parameter below:

Property Description
sonar.cxx.suffixes.sources Comma separated list of file name extensions to be considered as C++ source files during analysis.
Scope: system, project
Default: .cxx,.cpp,.cc,.c
sonar.cxx.suffixes.headers Comma separated list of file name extensions to be considered as C++ header files during analysis.
Scope: system, project
Default: .hxx,.hpp,.hh,.h
sonar.cxx.includeDirectories Comma separated list of directories where the plugin will be looking for included files.
Note: the 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:
sonar.cxx.forceIncludes 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:
sonar.cxx.defines<\td> 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 Sonar's Web 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: system, project
    Default: <\td> <\tr>
    sonar.cxx.cFilesPatterns 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.
    Scope: project
    Default: *.c,*.C
    sonar.cxx.cppcheck.reportPath Ant pattern describing the path to Cppcheck reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
    Scope: project
    Default:
    sonar.cxx.rats.reportPath Ant pattern describing the path to RATS reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
    Scope: project
    Default:
    sonar.cxx.valgrind.reportPath Ant pattern describing the path to Valgrind reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
    Scope: project
    Default:
    sonar.cxx.vera.reportPath Ant pattern describing the path to Vera++ reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
    Scope: project
    Default:
    sonar.cxx.drmemory.reportPath 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.
    Scope: project
    Default:
    sonar.cxx.xunit.reportPath 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.
    Scope: project
    Default:
    sonar.cxx.xunit.xsltURL 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:
    sonar.cxx.xunit.provideDetails If "True", tries to assign testcases in reports to test resources in SonarQube, thus making the drilldown to details possible
    Scope: project
    Default: False
    sonar.cxx.vstest.reportsPaths 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.
    Scope: project
    Default:
    sonar.cxx.nunit.reportsPaths 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.
    Scope: project
    Default:
    sonar.cxx.xunit.reportsPaths 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.
    Scope: project
    Default:
    sonar.cxx.pclint.reportPath 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.
    Scope: project
    Default:
    sonar.cxx.other.reportPath Ant pattern describing the path to other reports. Path can be relative or absolute. Single path or comma separated list of paths is supported.
    Scope: project
    Default:
    sonar.cxx.other.sqales deprecated with v0.9.6: SQALE characteristics for 'external' code analysers. Ant pattern describing the path to SQALE characteristics, relative to projects root.
    Scope: project
    Default:
    sonar.cxx.coverage.reportPath 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.
    Scope: project
    Default:
    sonar.cxx.coverage.itReportPath 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.
    Scope: project
    Default:
    sonar.cxx.coverage.overallReportPath 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.
    Scope: project
    Default:
    sonar.cxx.coverage.forceZeroCoverage 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.
    Scope: project
    Default: True
    sonar.cxx.compiler.parser The format of the warnings file. Currently supported are 'Visual C++' and 'GCC'.
    Scope: project
    Default: Visual C++
    sonar.cxx.compiler.reportPath 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
    Scope: project
    Default:
    sonar.cxx.compiler.regex Regular expression for four groups with this sequence:
    1. file name
    2. line number
    3. message id
    4. message text
    Scope: project
    Default: ^.*[\\\\,/](.*)\\(([0-9]+)\\)\\x20:\\x20warning\\x20(C\\d\\d\\d\\d):(.*)$
    sonar.cxx.compiler.charset Charset used for the compiler log file (sonar.cxx.compiler.reportPath) e.g. UTF-8, UTF-16 (for more see java.nio.charset.Charset)
    Scope: project
    Default: UTF-16

    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 the sonar-project.properties file now.
    • forceZeroCoverage: Depends on which key (sonar.cxx.coverage.reportPath, sonar.cxx.coverage.itReportPath, sonar.cxx.coverage.overallReportPath) is defined in the sonar-project.properties file now. Defining forceZeroCoverage 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 to sonar.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 to sonar.cxx.other.reportPath
    • Rename configuration setting sonar.cxx.include_directories to sonar.cxx.includeDirectories
    • new property sonar.cxx.forceIncludes

    Hints V0.9.0:

    • Use sonar.cxx.include_directories instead of sonar.cxx.includeDirectories