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 NameData TypeDescription
runDirstringThe directory from which the Code Analyzer analysis ran.
violationCountsObjectObject that contains the total number of violations and the aggregate counts for each severity level. See violationCounts Object Properties for details.
versionsObjectObject 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.
violationsObject[]An array of objects, where each object corresponds to a violation that was detected in the analysis. See violations Object Properties for details.
Property NameData TypeDescription
totalnumberTotal number of violations found in the analysis.
sev1numberNumber of severity 1 (Critical) violations found.
sev2numberNumber of severity 2 (High) violations found.
sev3numberNumber of severity 3 (Moderate) violations found.
sev4numberNumber of severity 4 (Low) violations found.
sev5numberNumber of severity 5 (Info) violations found.
Property NameData TypeDescription
code-analyzerstringVersion of the core Code Analyzer module.
cpdstringVersion of the CPD module.
eslintstringVersion of the ESLint module.
flowstringVersion of the Flow Scanner module.
pmdstringVersion of the PMD module.
retire-jsstringVersion of the RetireJS module.
regexstringVersion of the Regex module.
sfgestringVersion of the Salesforce Graph module.
Property NameData TypeDescription
rulestringThe name of the rule that's associated with the violation.
enginestringThe engine that's associated with the violation.
severitynumberThe severity level of the violation: 1 (Critical), 2 (High), 3 (Moderate), 4 (Low), 5 (Info)
tagsstring[]An array of tags that are associated with the rule that's associated with the violation.
primaryLocationIndexnumberThe index of the primary code location within the code locations array.
locationsObject[]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.
messagestringThe violation message.
resourcesstring[]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 NameData TypeDescription
filestringThe pathname of the file in which the violation occurred, relative to the runDir directory.
startLinenumberThe line where the violating code starts.
startColumnnumberThe column in the startLine where the violating code starts.
endLinenumberThe line where the violating code ends.
endColumnnumberThe column in the endLine where the violating code ends.
commentstringComment that provides additional context associated with this line or block of code.