{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "additionalProperties": false,
  "definitions": {
    "RuleType": {
      "title": "RuleType",
      "description": "An enumeration.",
      "enum": ["refactoring", "suggestion", "comment", "hover"]
    },
    "PythonVersion": {
      "title": "PythonVersion",
      "type": "object",
      "properties": {
        "major": {
          "title": "Major",
          "type": "integer"
        },
        "minor": {
          "title": "Minor",
          "type": "integer"
        }
      },
      "required": ["major", "minor"]
    },
    "RuleSettingsConfig": {
      "title": "RuleSettingsConfig",
      "type": "object",
      "properties": {
        "enable": {
          "title": "Enable",
          "default": ["default"],
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "disable": {
          "title": "Disable",
          "description": "A list of rule IDs Sourcery will never suggest.",
          "default": [],
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "rule_types": {
          "default": ["refactoring", "suggestion", "comment"],
          "type": "array",
          "items": {
            "$ref": "#/definitions/RuleType"
          }
        },
        "python_version": {
          "title": "Python Version",
          "description": "A string specifying the lowest Python version your project supports. Sourcery will not suggest refactorings requiring a higher Python version.",
          "anyOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/definitions/PythonVersion"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "RuleLanguage": {
      "title": "RuleLanguage",
      "description": "An enumeration.",
      "enum": ["python", "java", "javascript", "typescript"],
      "type": "string"
    },
    "PathsConfig": {
      "title": "PathsConfig",
      "type": "object",
      "properties": {
        "include": {
          "title": "Include",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "exclude": {
          "title": "Exclude",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    },
    "MatchRuleTestConfig": {
      "title": "MatchRuleTestConfig",
      "type": "object",
      "properties": {
        "match": {
          "title": "Match",
          "type": "string"
        },
        "expect": {
          "title": "Expect",
          "type": "string"
        }
      },
      "required": ["match"],
      "additionalProperties": false
    },
    "NoMatchRuleTestConfig": {
      "title": "NoMatchRuleTestConfig",
      "type": "object",
      "properties": {
        "no-match": {
          "title": "No-Match",
          "type": "string"
        }
      },
      "required": ["no-match"],
      "additionalProperties": false
    },
    "RuleConfig": {
      "title": "RuleConfig",
      "type": "object",
      "properties": {
        "id": {
          "title": "Id",
          "maxLength": 88,
          "pattern": "^[A-Za-z][A-Za-z0-9-_/:]*$",
          "type": "string"
        },
        "description": {
          "title": "Description",
          "type": "string"
        },
        "pattern": {
          "title": "Pattern",
          "type": "string"
        },
        "language": {
          "default": "python",
          "allOf": [
            {
              "$ref": "#/definitions/RuleLanguage"
            }
          ]
        },
        "replacement": {
          "title": "Replacement",
          "type": "string"
        },
        "condition": {
          "title": "Condition",
          "type": "string"
        },
        "explanation": {
          "title": "Explanation",
          "type": "string"
        },
        "paths": {
          "$ref": "#/definitions/PathsConfig"
        },
        "tests": {
          "title": "Tests",
          "default": [],
          "type": "array",
          "items": {
            "anyOf": [
              {
                "$ref": "#/definitions/MatchRuleTestConfig"
              },
              {
                "$ref": "#/definitions/NoMatchRuleTestConfig"
              }
            ]
          }
        },
        "tags": {
          "title": "Tags",
          "default": [],
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 88,
            "pattern": "^[A-Za-z][A-Za-z0-9-_/:]*$"
          }
        }
      },
      "required": ["id", "description", "pattern"],
      "additionalProperties": false
    },
    "MetricsConfig": {
      "title": "MetricsConfig",
      "type": "object",
      "properties": {
        "quality_threshold": {
          "title": "Quality Threshold",
          "default": 25.0,
          "type": "number"
        }
      },
      "additionalProperties": false
    },
    "RequestReview": {
      "title": "RequestReview",
      "type": "object",
      "properties": {
        "origin": {
          "title": "Origin",
          "default": "",
          "type": "string"
        },
        "forked": {
          "title": "Forked",
          "default": "",
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "GitHubConfig": {
      "title": "GitHubConfig",
      "type": "object",
      "properties": {
        "labels": {
          "title": "Labels",
          "default": [],
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "ignore_labels": {
          "title": "Ignore Labels",
          "default": ["sourcery-ignore"],
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "request_review": {
          "title": "Request Review",
          "default": "author",
          "anyOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/definitions/RequestReview"
            }
          ]
        },
        "sourcery_branch": {
          "title": "Sourcery Branch",
          "default": "sourcery-dev/{base_branch}",
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "CloneDetectionConfig": {
      "title": "CloneDetectionConfig",
      "type": "object",
      "properties": {
        "min_lines": {
          "title": "Min Lines",
          "default": 3,
          "type": "integer"
        },
        "min_duplicates": {
          "title": "Min Duplicates",
          "default": 2,
          "type": "integer"
        },
        "identical_clones_only": {
          "title": "Identical Clones Only",
          "default": false,
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },
    "ProxyConfig": {
      "title": "ProxyConfig",
      "type": "object",
      "properties": {
        "url": {
          "title": "Url",
          "minLength": 1,
          "maxLength": 65536,
          "format": "uri",
          "type": "string"
        },
        "ssl_certs_file": {
          "title": "Ssl Certs File",
          "type": "string"
        },
        "no_ssl_verify": {
          "title": "No Ssl Verify",
          "default": false,
          "type": "boolean"
        }
      },
      "additionalProperties": false
    }
  },
  "id": "https://json.schemastore.org/sourcery_yaml_schema.json",
  "properties": {
    "version": {
      "title": "Version",
      "description": "The schema version of this config file",
      "default": "1",
      "type": "string"
    },
    "ignore": {
      "title": "Ignore",
      "description": "A list of paths or files which Sourcery will ignore.",
      "default": [],
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "rule_settings": {
      "title": "Rule Settings",
      "default": {
        "enable": ["default"],
        "disable": [],
        "include": [],
        "skip": [],
        "rule_types": ["refactoring", "suggestion", "comment"],
        "python_version": null,
        "allow_adding_imports": false
      },
      "allOf": [
        {
          "$ref": "#/definitions/RuleSettingsConfig"
        }
      ]
    },
    "rules": {
      "title": "Rules",
      "description": "A list of custom rules Sourcery will include in its analysis.",
      "default": [],
      "type": "array",
      "items": {
        "$ref": "#/definitions/RuleConfig"
      }
    },
    "rule_tags": {
      "title": "Rule Tags",
      "description": "Additional rule tags.",
      "default": {},
      "type": "object",
      "additionalProperties": {
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    },
    "metrics": {
      "title": "Metrics",
      "default": {
        "quality_threshold": 25
      },
      "allOf": [
        {
          "$ref": "#/definitions/MetricsConfig"
        }
      ]
    },
    "github": {
      "title": "Github",
      "default": {
        "labels": [],
        "ignore_labels": ["sourcery-ignore"],
        "review_or_request_review": "author",
        "sourcery_branch": "sourcery-dev/{base_branch}"
      },
      "allOf": [
        {
          "$ref": "#/definitions/GitHubConfig"
        }
      ]
    },
    "clone_detection": {
      "title": "Clone Detection",
      "default": {
        "min_lines": 3,
        "min_duplicates": 2,
        "identical_clones_only": false
      },
      "allOf": [
        {
          "$ref": "#/definitions/CloneDetectionConfig"
        }
      ]
    },
    "proxy": {
      "title": "Proxy",
      "default": {
        "url": null,
        "ssl_certs_file": null,
        "no_ssl_verify": false
      },
      "allOf": [
        {
          "$ref": "#/definitions/ProxyConfig"
        }
      ]
    }
  },
  "title": "Sourcery YAML Schema",
  "type": "object"
}