JSON Run Output Schema Reference
This example shows how to create a JSON-formatted output file when using the --output-file
flag of the code-analyzer run
command.
This sample output shows 3 violations with different severities from different engines.
Property Name | Data Type | Description |
---|
runDir | string | The directory from which the Code Analyzer analysis ran. |
violationCounts | Object | Object that contains the total number of violations and the aggregate counts for each severity level. See violationCounts Object Properties for details. |
versions | Object | Object that contains the versions of the core Code Analyzer module and each engine module that ran in the analysis. See versions Object Properties for details. |
violations | Object[] | An array of objects, where each object corresponds to a violation that was detected in the analysis. See violations Object Properties for details. |
Property Name | Data Type | Description |
---|
total | number | Total number of violations found in the analysis. |
sev1 | number | Number of severity 1 (Critical) violations found. |
sev2 | number | Number of severity 2 (High) violations found. |
sev3 | number | Number of severity 3 (Moderate) violations found. |
sev4 | number | Number of severity 4 (Low) violations found. |
sev5 | number | Number of severity 5 (Info) violations found. |
Property Name | Data Type | Description |
---|
rule | string | The name of the rule that's associated with the violation. |
engine | string | The engine that's associated with the violation. |
severity | number | The severity level of the violation: 1 (Critical), 2 (High), 3 (Moderate), 4 (Low), 5 (Info) |
tags | string[] | An array of tags that are associated with the rule that's associated with the violation. |
primaryLocationIndex | number | The index of the primary code location within the code locations array. |
locations | Object[] | An array of objects, where each object corresponds to a location in your code that's associated with the violation. See locations Object Properties for details. |
message | string | The violation message. |
resources | string[] | An array of URLs for additional resources and information about the violation. |
Some rules, such as those that have a PathBased
tag, can produce multiple code locations. These code locations make up the code path associated with the violation.
Property Name | Data Type | Description |
---|
file | string | The pathname of the file in which the violation occurred, relative to the runDir directory. |
startLine | number | The line where the violating code starts. |
startColumn | number | The column in the startLine where the violating code starts. |
endLine | number | The line where the violating code ends. |
endColumn | number | The column in the endLine where the violating code ends. |
comment | string | Comment that provides additional context associated with this line or block of code. |