[External Analyzer Reports] Report generation for various languages

Hello,

Here is a quick guide about how to generate issues reports with different linters with the intent to load them into SonarQube or SonarCloud.
These commands were used when we implemented this feature. If you are using other commands feel free to share them as comments.
If you have trouble to import external issues reports, please ask for help on the dedicated "Get help" category.

Have a look at https://docs.sonarqube.org/latest/analysis/external-issues/ to know all the external linters you can integrate with SonarQube or SonarCloud and to know which property to use to feed them.

Linter Language Command
StyleLint CSS stylelint src/*.css --config stylelintconfig.json -f json > stylelint-report.json
ESLint JS eslint -f json -o report.json .
AndroidLint Kotlin gradle lint or $ANDROID_HOME/tools/bin/lint --xml lint-results.xml path/to/project
Detekt Kotlin java -jar path/to/detekt-cli-1.0.0.RC7-3-all.jar -i path/to/project -o path/to/report-directory
Pylint Python pylint <module_or_package> -r n --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" > <report_file>
Bandit Python bandit --format json --output bandit-report.json --recursive /path/to/your/python/project
Rubocop Ruby rubocop --format json --out rubocop-report.json
SwiftLint Swift swiftlint lint --reporter json > swiftlint.json
TSLint TypeScript tslint -t json -o report.json --project .
GoVet Go go vet 2> govet-report.out
GoLint Go golint > golint-report.out
GoMetaLinter Go gometalinter > gometalinter-report.out

This content was previously part of SonarQube’s documentation but it applies for both SonarQube and SonarCloud so we thought it would be better to share it here.

1 Like

2 posts were split to a new topic: [Swift] Error when importing swiftlint report