Skip to content

SonarQube

Report name: sonarqube

Available in all: No

Report that generates a Sonarqube generic formatter format output file. Read more about the integration with SonarQube at SonarQube integration.

Enable with:

robocop check --reports sonarqube
[tool.robocop.lint]
reports = [
    "sonarqube"
]

It will create robocop_sonar_qube.json file in the current directory.

Configuration

Output path

You can configure an output path with the output_path option. It's a relative path to the file that will be produced by the report:

robocop check --reports sonarqube --configure sonarqube.output_path=output/sonarqube.json
[tool.robocop.lint]
reports = [
    "sonarqube"
]
configure = [
    "sonarqube.output_path=output/sonarqube.json"
]

The default path is robocop_sonar_qube.json.

Sonar version

Robocop supports SonarQube generic formatter formats versions 9.9 and 10.3 (default). Both versions use different output schemas and are not compatible.

You can configure the version of the SonarQube generic formatter format with the sonar_version option:

robocop check --reports sonarqube --configure sonarqube.sonar_version=9.9
[tool.robocop.lint]
reports = [
    "sonarqube"
]
configure = [
    "sonarqube.sonar_version=9.9"
]

Skip on empty

By default, the report file is generated even if Robocop did not find any issue. Set the skip_on_empty option to True to not create the file when there is nothing to report:

robocop check --reports sonarqube --configure sonarqube.skip_on_empty=True
[tool.robocop.lint]
reports = [
    "sonarqube"
]
configure = [
    "sonarqube.skip_on_empty=True"
]

If the file was created by a previous run, it is left untouched.