Generic issue data
SonarCloud supports a generic format for importing issues generated by external analysis tools, like linters. This feature can help you integrate a tool that is not directly supported by SonarCloud by having your custom CI task convert the output of the unsupported tool to this generic format, which can then be imported into SonarCloud.
External issues have the limitation that the activation of the rules that raise these issues cannot be managed within SonarCloud. External rules are not visible on the Rules page or reflected in any Quality Profile.
External issues and the rules that raise them must be managed in the configuration of your external tool.
Import
You can set up the import of the report files by defining the analysis parameter sonar.externalIssuesReportPaths
on the CI/CD host with the list of import directories or files. This parameter accepts a comma-delimited list of paths (a file path definition is either relative to the sonar.projectBaseDir
property, which is by default the directory from which the analysis was started, or absolute).
Each report must contain, at top-level, an array of Rule objects named rules
and an array of Issue objects named issues
. The report fields for each object type are listed below. For information about the Clean Code attribute, software quality, impact and severity, see Clean Code.
Issue types are deprecated and the severity feature has evolved (see Clean Code for details). The related fields will be updated in the future.
Rule fields: Rule fields:
id
- stringname
- stringdescription
- string, optionalengineId
- string. Identifier of the external analyzer that provides the rule.cleanCodeAttribute
- string e.g., CONVENTIONAL, CLEAR, DISTINCT, LAWFUL (for more information, see here)impacts
- list of Impact objects, consisting a software quality and severity level to which the rule's clean code attribute contributes, for example, MAINTAINABILITY and HIGH.
Issue fields:
engineId
- stringruleId
- stringprimaryLocation
- Location objecteffortMinutes
- integer, optional. Defaults to 0secondaryLocations
- array of Location objects, optional
Location fields:
message
- stringfilePath
- stringtextRange
- TextRange object, for secondary locations
TextRange fields:
startLine
- integer. 1-indexedendLine
- integer, optional. 1-indexedstartColumn
- integer, optional. 0-indexed. Note:startColumn
must not be specified for empty linesendColumn
- integer, optional. 0-indexed
Example
Here is an example of the expected format:
Was this page helpful?