Complement SonarQube analyzer with 3rd party linters:
SonarQube doc: https://docs.sonarsource.com/sonarqube-server/analyzing-source-code/importing-external-issues/external-analyzer-reports
To setup the import of issues generated by Govet:
Set up the generation of the reports by Govet and their storing in dedicated import directory(ies).
Command example:
go vet 2> govet-report.out
Set up the import of the generated report files by SonarQube by defining on the CI/CD host the analysis parameter sonar.go.govet.reportPaths with the list of import directories or files. This parameter accepts a comma-delimited list of paths. A path definition is either relative to the sonar.projectBaseDir analysis parameter (which is by default the directory from which the analysis was started) or absolute.
---
To setup the import of issues generated by GoLint:
Set up the generation of the reports by Govet and their storing in dedicated import directory(ies).
Command example:
golint > golint-report.out
Set up the import of the generated report files by SonarQube by defining on the CI/CD host the analysis parameter sonar.go.golint.reportPaths with the list of import directories or files. This parameter accepts a comma-delimited list of paths. A path definition is either relative to the sonar.projectBaseDir analysis parameter (which is by default the directory from which the analysis was started) or absolute.
---
To setup the import of issues generated by golangci-lint:
Set up the generation of the reports by golangci-lint in checkstyle format and their storing in dedicated import directory(ies).
For the report generation, use the --output.checkstyle.path=golangci-lint-report.xml option.
Set up the import of the generated report files by SonarQube by defining on the CI/CD host the analysis parameter sonar.go.golangci-lint.reportPaths with the list of import directories or files. This parameter accepts a comma-delimited list of paths. A path definition is either relative to the sonar.projectBaseDir analysis parameter (which is by default the directory from which the analysis was started) or absolute.
---
To setup the import of issues generated by gosec:
Set up the generation of the reports by gosec in SonarQube format and their storing in dedicated import directory(ies).
For the report generation, use the -fmt=sonarqube gosec option.
Set up the import of the generated report files by SonarQube by defining on the CI/CD host the analysis parameter sonar.externalIssuesReportPaths with the list of import directories or files. This parameter accepts a comma-delimited list of paths. A path definition is either relative to the sonar.projectBaseDir analysis parameter (which is by default the directory from which the analysis was started) or absolute.
For other linters the output generated will have to be transformed in the SonarQube Generic format documented at: https://docs.sonarsource.com/sonarqube-server/analyzing-source-code/importing-external-issues/generic-issue-import-format
Complement SonarQube analyzer with 3rd party linters:
golangci-lintstaticcheck(newer version ofgovet)revive(newer version ofgolint)SonarQube doc: https://docs.sonarsource.com/sonarqube-server/analyzing-source-code/importing-external-issues/external-analyzer-reports
For other linters the output generated will have to be transformed in the SonarQube Generic format documented at: https://docs.sonarsource.com/sonarqube-server/analyzing-source-code/importing-external-issues/generic-issue-import-format