JSON Rules Output Schema Reference

This example shows how to create a JSON-formatted output file when using the --output-file flag of the code-analyzer rules command.

sf code-analyzer rules --rule-selector flow --output-file rules.json

Sample JSON Rules Output

This sample output shows the two rules associated with the flow engine.

{
  "rules": [
    {
      "name": "PreventPassingUserDataIntoElementWithoutSharing",
      "description": "Avoid passing user data into Flow Scanner elements in run mode: Without Sharing",
      "engine": "flow",
      "severity": 2,
      "tags": [
        "Recommended",
        "Security",
        "XML"
      ],
      "resources": []
    },
    {
      "name": "PreventPassingUserDataIntoElementWithSharing",
      "description": "Avoid passing user data into Flow Scanner elements in run mode: With Sharing",
      "engine": "flow",
      "severity": 4,
      "tags": [
        "Recommended",
        "Security",
        "XML"
      ],
      "resources": []
    }
  ]
}

Properties of the Top-Level "rules" Object

Property Name Data Type Description
name string The name of the rule.
description string The description of the rule.
engine string The engine that's associated with the rule.
severity string The default severity level of the rule: 1 (Critical), 2 (High), 3 (Moderate), 4 (Low), 5 (Info)
tags string[] An array of tags that are associated with the rule, such as Recommended, Security, or BestPractices.
resources string[] An array of URLs for additional resources and information about the rule.