XML Output Schema Reference

This example shows how to create a XML-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.

ElementData TypeDescription
<runDir>stringThe directory from which the Code Analyzer analysis ran.
<violationCounts>complexTypeContains elements that show the total number of violations and the aggregate counts for each severity level. See <violationCounts> Element for details.
<versions>complexTypeContains elements that show the versions of the core Code Analyzer module and each engine module that ran in the analysis. See <versions> Element for details.
<violations>complexType[]An array of <violation> elements, where each element corresponds to a violation that was detected in the analysis. See <violation> Element for details.
ElementData TypeDescription
<total>numberTotal number of violations found in the analysis.
<sev1>numberNumber of severity 1 (Critical) violations found.
<sev2>numberNumber of severity 2 (High) violations found.
<sev3>numberNumber of severity 3 (Moderate) violations found.
<sev4>numberNumber of severity 4 (Low) violations found.
<sev5>numberNumber of severity 5 (Info) violations found.
ElementData TypeDescription
<code-analyzer>stringVersion of the core Code Analyzer module.
<cpd>stringVersion of the CPD module.
<eslint>stringVersion of the ESLint module.
<flow>stringVersion of the Flow Scanner module.
<pmd>stringVersion of the PMD module.
<retire-js>stringVersion of the RetireJS module.
<regex>stringVersion of the Regex module.
<sfge>stringVersion of the Salesforce Graph module.
ElementData TypeDescription
<rule>stringThe name of the rule that's associated with the violation.
<engine>stringThe engine that's associated with the violation.
<severity>numberThe severity level of the violation: 1 (Critical), 2 (High), 3 (Moderate), 4 (Low), 5 (Info)
<tags>string[]An array of elements that contain the tags that are associated with the rule that's associated with the violation.
<primaryLocationIndex>numberThe index of the primary code location within the code locations array.
<locations>complexType[]An array of <location> elements, where each element corresponds to a location in your code that's associated with the violation. See location Object Properties for details.
<message>stringThe violation message.
<resources>string[]An array of elements that contain 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.

PropertyData TypeDescription
<file>stringThe pathname of the file in which the violation occurred, relative to the runDir directory.
<startLine>numberThe line where the violating code starts.
<startColumn>numberThe column in the startLine where the violating code starts.
<endLine>numberThe line where the violating code ends.
<endColumn>numberThe column in the endLine where the violating code ends.
<comment>stringComment that provides additional context associated with this line or block of code.