{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/sigrid-scope-configuration-file/latest.json",
  "title": "Sigrid scope configuration file",
  "description": "Analysis scope configuration file used by Sigrid (sigrid-says.com)",
  "x-lintel": {
    "source": "https://www.schemastore.org/sigrid-scope-file.schema.json",
    "sourceSha256": "c9b96e1f6897d3a2b9e35c0fda09134880993af414a2591ecbb94cbfa5a012a3",
    "fileMatch": [
      "sigrid.yaml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "default_excludes": {
      "type": "boolean",
      "description": "When true, excludes files and directories from the analysis scope based on common conventions."
    },
    "exclude": {
      "$ref": "#/$defs/file_pattern_list",
      "description": "List of file and directory patterns to manually exclude from the analysis."
    },
    "component_depth": {
      "type": "integer",
      "description": "Directory depth that will be used to define components."
    },
    "component_base_dirs": {
      "$ref": "#/$defs/file_pattern_list"
    },
    "components": {
      "$ref": "#/$defs/component_list"
    },
    "experimental": {
      "type": "boolean",
      "description": "Enable experimental analysis features."
    },
    "languages": {
      "$ref": "#/$defs/language_list",
      "description": "A list of technologies that should be included as part of the analysis."
    },
    "model": {
      "$ref": "#/$defs/model",
      "description": "SIG Maintainability Model that should be used for the analysis, defaults to latest."
    },
    "dependencychecker": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "When this *or* the 'blocklist' option is provided, OSH analysis is performed for every upload."
        },
        "blocklist": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "List of patterns for library names that should not be sent to external services."
        },
        "blacklist": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Deprecated, use 'blocklist' instead."
        },
        "transitive": {
          "type": "boolean",
          "description": "When true, transitive dependencies are also checked and included in the results."
        },
        "exclude": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string",
                    "description": "Excludes all dependencies in paths matching the specified regular expression."
                  }
                },
                "required": [
                  "path"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "vulnerability": {
                    "type": "string",
                    "description": "Excludes all vulnerabilities matching the specified identifier (e.g. 'CVE-123')."
                  }
                },
                "required": [
                  "vulnerability"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "license": {
                    "type": "string",
                    "description": "Excludes license risks identified in dependencies with the specified name."
                  }
                },
                "required": [
                  "license"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "activity": {
                    "type": "string",
                    "description": "Excludes activity risks identified in dependencies with the specified name."
                  }
                },
                "required": [
                  "activity"
                ]
              }
            ]
          },
          "description": "List of paths and/or dependencies that should be ignored for Open Source Health."
        },
        "model": {
          "$ref": "#/$defs/model",
          "description": "SIG Open Source Health model version that should be used for the analysis, defaults to latest."
        },
        "override_enabled_technologies": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "List of additional technologies to analyze, which are not enabled by default."
        },
        "override_disabled_technologies": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "List of technologies for which the analysis should be disabled."
        },
        "source": {
          "$ref": "#/$defs/dependency_checker_source"
        }
      },
      "required": [],
      "additionalProperties": false
    },
    "architecture": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "When true, architecture analysis will be triggered for each incoming upload."
        },
        "model": {
          "$ref": "#/$defs/model",
          "description": "SIG Architecture Quality Model that should be used for the analysis, defaults to latest."
        },
        "exclude": {
          "$ref": "#/$defs/file_pattern_list",
          "description": "List of exclude patterns that applies only to Architecture Quality, not globally."
        },
        "custom_components": {
          "type": "boolean",
          "description": "Deprecated. This option is obsolete."
        },
        "file_annotation_components": {
          "type": "boolean",
          "description": "Automatic componentization based on @sigrid:component annotations in source files."
        },
        "flatten_directories": {
          "$ref": "#/$defs/file_pattern_list",
          "description": "List of directory names that should be flattened and not considered as components during the analysis."
        },
        "add_system_elements": {
          "$ref": "#/$defs/system_element_list",
          "description": "List of system elements that are manually defined and added to the architecture graph."
        },
        "remove_system_elements": {
          "$ref": "#/$defs/system_element_list",
          "description": "List of system elements to manually remove from the architecture graph."
        },
        "add_dependencies": {
          "$ref": "#/$defs/dependency_list",
          "description": "List of manually added dependencies on top of the ones detected automatically by the analysis."
        },
        "remove_dependencies": {
          "$ref": "#/$defs/dependency_list",
          "description": "List of dependencies that manually overrides the analysis and removes them from the results."
        },
        "undesirable_dependencies": {
          "$ref": "#/$defs/dependency_list",
          "description": "List of dependencies considered undesirable, and should therefore be highlighted in the visualization."
        },
        "rename": {
          "type": "object",
          "description": "Map of system elements for which to manually override the name.",
          "additionalProperties": {
            "type": "string"
          }
        },
        "merge_data_stores": {
          "type": "boolean",
          "description": "Default is false. When true, skips automated data store detection and assumes one monolithic data store."
        },
        "grouping": {
          "$ref": "#/$defs/architecture_group_list",
          "description": "Annotate all top-level components matching the pattern, in order to divide them into logical groups."
        },
        "component_roles": {
          "$ref": "#/$defs/architecture_component_role_list",
          "description": "Attaches role labels to all matching components, describing their role in the architecture."
        },
        "history_enabled": {
          "type": "boolean",
          "description": "Deprecated. This option is obsolete."
        },
        "history": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "string"
            }
          ],
          "description": "Deprecated. This option is obsolete."
        },
        "history_period_months": {
          "type": "integer",
          "description": "Period to use for repository history analysis, default is last 12 months."
        },
        "history_start": {
          "$ref": "#/$defs/yyyymmdd",
          "description": "Repository history start date in the format 'yyyy-mm-dd', default is last year."
        },
        "history_end": {
          "$ref": "#/$defs/yyyymmdd",
          "description": "Repository history end date in the format 'yyyy-mm-dd', default is current date."
        },
        "history_interval": {
          "$ref": "#/$defs/interval",
          "description": "Either 'week' (default) or ‘month’."
        },
        "history_filter_outliers": {
          "type": "boolean",
          "description": "Filters commits with an abnormally large amount of churn from the history analysis."
        },
        "branch": {
          "$ref": "#/$defs/branches",
          "description": "Deprecated. This option is obsolete."
        },
        "duplication": {
          "type": "boolean",
          "description": "Set to false to disable duplication detection, improves performance for huge systems."
        },
        "co_evolution": {
          "type": "boolean",
          "description": "Set to false to disable co-evolution detection, improves performance for huge systems."
        },
        "disabled_metrics": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "List of metrics that should be removed from the analysis and set to N/A."
        },
        "custom_patterns": {
          "$ref": "#/$defs/architecture_patterns",
          "description": "Adds additional custom patterns to the architecture knowledge base used for the analysis."
        }
      },
      "required": [],
      "additionalProperties": false
    },
    "thirdpartyfindings": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "When true, third party findings analysis will be triggered for each incoming upload."
        },
        "disabled_analyzers": {
          "$ref": "#/$defs/analyzer_list",
          "description": "List of third-party analyzers that should not be ran."
        },
        "disabled_rules": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "List of rule IDs that should not be reported by Sigrid."
        },
        "enabled_analyzers": {
          "$ref": "#/$defs/analyzer_list",
          "description": "List of third-party analyzer names that should be ran even though they are disabled by default."
        },
        "enabled_rules": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "List of rule IDs that should be reported by Sigrid, even though they are disabled by default."
        },
        "include": {
          "$ref": "#/$defs/file_pattern_list",
          "description": "List of file/directory patterns that should be included in the third party findings analysis beyond the maintainability scope and production configuration files."
        },
        "exclude": {
          "$ref": "#/$defs/file_pattern_list",
          "description": "List of file/directory patterns that should be excluded from the third party findings analysis."
        }
      },
      "required": [],
      "additionalProperties": false
    },
    "checkmarx": false
  },
  "required": [
    "languages"
  ],
  "additionalProperties": true,
  "$defs": {
    "organization": {
      "type": "string",
      "pattern": "^[a-z0-9]{2,}$"
    },
    "system": {
      "type": "string",
      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
    },
    "model": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "20[0-9]{2}"
        },
        {
          "type": "integer",
          "minimum": 2000,
          "exclusiveMaximum": 2100
        }
      ]
    },
    "language_name": {
      "type": "string",
      "minLength": 1
    },
    "yyyymmdd": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "20\\d{2}-?\\d{2}-?\\d{2}"
        },
        {
          "type": "integer",
          "minimum": 20000000,
          "exclusiveMaximum": 21000000
        }
      ]
    },
    "interval": {
      "type": "string",
      "enum": [
        "week",
        "month"
      ]
    },
    "branches": {
      "type": "string",
      "pattern": "^[0-9a-zA-Z]+(,[0-9a-zA-Z]+)*$"
    },
    "file_pattern_list": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "component": {
      "anyOf": [
        {
          "type": "null"
        },
        {
          "type": "object",
          "properties": {
            "include": {
              "$ref": "#/$defs/file_pattern_list"
            },
            "exclude": {
              "$ref": "#/$defs/file_pattern_list"
            },
            "override": {
              "type": "boolean"
            }
          },
          "additionalProperties": false
        }
      ]
    },
    "component_list": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "include": {
            "$ref": "#/$defs/file_pattern_list"
          },
          "exclude": {
            "$ref": "#/$defs/file_pattern_list"
          }
        },
        "additionalProperties": false
      }
    },
    "language": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "name": {
              "$ref": "#/$defs/language_name"
            },
            "production": {
              "$ref": "#/$defs/component"
            },
            "test": {
              "$ref": "#/$defs/component"
            },
            "generated": {
              "$ref": "#/$defs/component"
            },
            "supplementary": {
              "$ref": "#/$defs/component"
            }
          },
          "additionalProperties": false
        },
        {
          "$ref": "#/$defs/language_name"
        }
      ]
    },
    "language_list": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/language"
      },
      "minItems": 1
    },
    "analyzer_list": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "pattern_list": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "system_element": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": true
    },
    "system_element_list": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/system_element"
      }
    },
    "dependency": {
      "type": "object",
      "properties": {
        "source": {
          "type": "string"
        },
        "target": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "count": {
          "type": "integer"
        },
        "bidirectional": {
          "type": "boolean"
        }
      },
      "required": [
        "source",
        "target"
      ],
      "additionalProperties": false
    },
    "dependency_list": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/dependency"
      }
    },
    "architecture_group": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "annotation": {
          "type": "string"
        },
        "include": {
          "$ref": "#/$defs/file_pattern_list"
        },
        "exclude": {
          "$ref": "#/$defs/file_pattern_list"
        }
      },
      "required": [
        "name",
        "include"
      ],
      "additionalProperties": false
    },
    "architecture_group_list": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/architecture_group"
      }
    },
    "architecture_component_role": {
      "type": "object",
      "properties": {
        "role": {
          "type": "string"
        },
        "include": {
          "$ref": "#/$defs/file_pattern_list"
        },
        "exclude": {
          "$ref": "#/$defs/file_pattern_list"
        }
      },
      "required": [
        "role",
        "include"
      ],
      "additionalProperties": false
    },
    "architecture_component_role_list": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/architecture_component_role"
      }
    },
    "architecture_patterns": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/architecture_pattern"
      }
    },
    "architecture_pattern": {
      "type": "object",
      "properties": {
        "description": {
          "type": "string"
        }
      },
      "required": [
        "description"
      ],
      "additionalProperties": true
    },
    "dependency_checker_source": {
      "type": "string",
      "enum": [
        "all",
        "sbom"
      ]
    }
  }
}
