SARIF output
The Qodana IntelliJ linter produces the SARIF output, which is a JSON file formatted in accordance with the specification. The Qodana implementation follows the general format rules but also specifies several custom properties written in propertyBag.
Report example
Common structure
A report file always contains one Run object. This object always contains the following sections:
Invocations
The list of Invocation objects, which always contains a single invocation object. An invocation comprises the following:
exitCode
- tool exit code.0
- indicates successful execution.1
- indicates any internal error.255
- indicates successful execution, but the exit code is non-zero due tofailThreshold
property.
executionSuccessful
- ifexitCode
is0
or255
.exitCodeDescription
- the description of the exit code for non-zero values.
AutomationDetails
The AutomationDetails object, which contains:
guid
- a unique report ID.id
- a user-defined string, should be unique for the report.
VersionControlProvenance
The list of VersionControlDetails objects, which contains zero or one object corresponding to the vcs repository in project root. Currently supported VCS list: Git.
An object contains the following:
repositoryUri
- the repository checkout URL.revisionId
- the last commit hash.branch
- the current repository branch.properties
- thepropertyBag
object with thevcsType
field, which can be any of the following:Git
Hg
Svn
Tool
The Tool object contains the description of the Docker image, bundled plugins and inspections in them.
Results
The list of Result objects.
Tool object
Tool example
Tool structure
driver
- ToolComponent object, which describes the Qodana Intellij Linter tool.extensions
- the list of ToolComponent objects. Each element of the list corresponds to the Intellij IDEA plugin used for this run.
ToolComponent structure
The object contains:
name
- thepluginId
for an Intellij IDEA plugin, "Qodana Intellij Linter" for the driver.version
- the plugin version for an Intellij IDEA plugin, the tool version for the driver.rules
- the list of ReportingDescriptor objects.
ReportingDescriptor structure
The object contains:
id
- theinspectionId
, that is, the short name of an inspection.shortDescription
- [MultiformatMessageString object]. Contains the fieldtext
with the name of an inspection as a value.fullDescription
- [MultiformatMessageString object]. Contains the fieldtext
with the description of an inspection as a value. The description string is provided in the HTML format.defaultConfiguration
- ReportingConfiguration object. The configuration of an inspection used by default.
ReportingConfiguration structure
The object contains:
enabled
- true/false.level
- the SARIF severity level of a rule.
SARIF severity
The SARIF severity values could be one of the following strings:
error
- if the Intellij IDEA inspection severity is "ERROR".warning
- if the Intellij IDEA inspection severity is "WARNING".note
- in any other case.
The original Intellij IDEA inspection severity is stored in the same object's propertyBag
field.
Result object
Result example
Result structure
ruleId
- the inspection short name (inspectionId
), which is a unique inspection identifier.kind
- always "fail".level
- SARIF severity level.message
- an object of type Message with a single fieldtext
, which contains the result/problem description in the format of an Intellij IDEA message string.partialFingerprints
- a technical field contains hashes for comparing results between different runs. Used in the baseline feature.baselineState
- the field only appears if a linter was executed in baseline mode and can be any of the following:new
: The problem was detected only in the current run but not in the baseline run.absent
: The problem was detected only in the baseline run but not in the current run.unchanged
: The problem was detected both in the current run and in the baseline run.
properties
- apropertyBag
with theideaSeverity
field with the original Intellij IDEA inspection severity as a value.locations
- the list of Location objects. Always contains a single element.
Location structure
The object contains:
logicalLocations
- the list of LogicalLocation objects, which contains zero or one element corresponding to the module in which the result appears. A module can be a Gradle subproject, Maven module, and so on.physicalLocation
- the PhysicalLocation object. Could be absent.
LogicalLocation Structure
The object contains:
kind
- always "module".fullyQualifiedName
- the module name obtained from the project build system.
PhysicalLocation structure
The object contains:
artifactLocation
- ArtifactLocation object, which contains the following:uri
- the path relative to the project root.uriBaseId
- always has the value "SRCROOT".
region
- Region object, which is a part of the artifact's location containing the text that should be highlighted as a reason of the current result.contextRegion
- the Region object, which is a part of the artifact location's surrounding region. Typically, two rows above and under region. Used for problems comparisons in baseline.
Region structure
The object contains:
startLine
- the one-based line number of the first character in the region.startColumn
- the one-based column number of the first character in the region.charOffset
- the zero-based character offset of the first character in the region from the beginning of the artifact.charLength
- region length in characters.snippet
- ArtifactContent object, which contains the fieldtext
with the value equal to the text of the specified region extracted from the artifact.