swt 5.0.0-rc.7

🍬 Sweet: A blazing-fast code health and architecture analyzer.
Documentation
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Config",
  "description": "Global analyzer configuration.",
  "type": "object",
  "properties": {
    "$schema": {
      "description": "Json schema.",
      "type": [
        "string",
        "null"
      ],
      "writeOnly": true
    },
    "cross_file_repetition": {
      "description": "Enable project-wide repetition analysis across different files.",
      "type": "boolean",
      "default": false
    },
    "exclude": {
      "description": "Glob patterns for files/directories to exclude.",
      "type": "array",
      "default": [
        "node_modules",
        "vendor",
        "dist",
        "target",
        "__pycache__",
        "build",
        ".git"
      ],
      "items": {
        "type": "string"
      }
    },
    "thresholds": {
      "description": "Global and language-specific threshold overrides.",
      "$ref": "#/$defs/ThresholdsConfig",
      "default": {
        "global": {
          "max_depth": 6,
          "max_imports": 25,
          "max_lines": 400,
          "max_repetition": 15.0,
          "min_duplicate_lines": 4
        },
        "overrides": {
          "cpp": null,
          "cs": null,
          "gd": null,
          "go": null,
          "java": null,
          "js": null,
          "lua": null,
          "php": null,
          "py": null,
          "rs": null,
          "ts": null
        },
        "severities": {
          "max_depth": null,
          "max_imports": null,
          "max_lines": null,
          "max_repetition": null
        }
      }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "PartialThresholds": {
      "description": "Sparse threshold structure for specific overrides.",
      "type": "object",
      "properties": {
        "max_depth": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint",
          "minimum": 0
        },
        "max_imports": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint",
          "minimum": 0
        },
        "max_lines": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint",
          "minimum": 0
        },
        "max_repetition": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "min_duplicate_lines": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint",
          "minimum": 0
        }
      }
    },
    "RuleSeverities": {
      "description": "Mapping of rules to their severity levels.",
      "type": "object",
      "properties": {
        "max_depth": {
          "description": "Severity for `max_depth` rule.",
          "anyOf": [
            {
              "$ref": "#/$defs/Severity"
            },
            {
              "type": "null"
            }
          ]
        },
        "max_imports": {
          "description": "Severity for `max_imports` rule.",
          "anyOf": [
            {
              "$ref": "#/$defs/Severity"
            },
            {
              "type": "null"
            }
          ]
        },
        "max_lines": {
          "description": "Severity for `max_lines` rule.",
          "anyOf": [
            {
              "$ref": "#/$defs/Severity"
            },
            {
              "type": "null"
            }
          ]
        },
        "max_repetition": {
          "description": "Severity for `max_repetition` rule.",
          "anyOf": [
            {
              "$ref": "#/$defs/Severity"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "Severity": {
      "description": "Importance level of a rule violation.",
      "oneOf": [
        {
          "description": "Blocks the build (exit code 1).",
          "type": "string",
          "const": "error"
        },
        {
          "description": "Informational warning (exit code 0).",
          "type": "string",
          "const": "warning"
        }
      ]
    },
    "Thresholds": {
      "description": "Defines health metric limits for analysis.",
      "type": "object",
      "properties": {
        "max_depth": {
          "description": "Maximum allowed control flow nesting depth.",
          "type": "integer",
          "format": "uint",
          "default": 6,
          "minimum": 0
        },
        "max_imports": {
          "description": "Maximum allowed import/dependency statements.",
          "type": "integer",
          "format": "uint",
          "default": 25,
          "minimum": 0
        },
        "max_lines": {
          "description": "Maximum allowed source lines of code.",
          "type": "integer",
          "format": "uint",
          "default": 400,
          "minimum": 0
        },
        "max_repetition": {
          "description": "Maximum allowed repetition percentage (0-100).",
          "type": "number",
          "format": "double",
          "default": 15.0
        },
        "min_duplicate_lines": {
          "description": "Minimum identical lines to trigger repetition detection.",
          "type": "integer",
          "format": "uint",
          "default": 4,
          "minimum": 0
        }
      },
      "additionalProperties": false
    },
    "ThresholdsConfig": {
      "description": "Threshold management container.",
      "type": "object",
      "properties": {
        "global": {
          "description": "Default thresholds for all files.",
          "$ref": "#/$defs/Thresholds",
          "default": {
            "max_depth": 6,
            "max_imports": 25,
            "max_lines": 400,
            "max_repetition": 15.0,
            "min_duplicate_lines": 4
          }
        },
        "overrides": {
          "description": "Language-specific overrides.",
          "$ref": "#/$defs/ThresholdsOverrides",
          "default": {
            "cpp": null,
            "cs": null,
            "gd": null,
            "go": null,
            "java": null,
            "js": null,
            "lua": null,
            "php": null,
            "py": null,
            "rs": null,
            "ts": null
          }
        },
        "severities": {
          "description": "Rule-specific severity levels.",
          "$ref": "#/$defs/RuleSeverities",
          "default": {
            "max_depth": null,
            "max_imports": null,
            "max_lines": null,
            "max_repetition": null
          }
        }
      },
      "additionalProperties": false
    },
    "ThresholdsOverrides": {
      "description": "Known and custom language overrides.",
      "type": "object",
      "properties": {
        "cpp": {
          "description": "`C/C++` overrides",
          "anyOf": [
            {
              "$ref": "#/$defs/PartialThresholds"
            },
            {
              "type": "null"
            }
          ]
        },
        "cs": {
          "description": "C# overrides (.cs)",
          "anyOf": [
            {
              "$ref": "#/$defs/PartialThresholds"
            },
            {
              "type": "null"
            }
          ]
        },
        "gd": {
          "description": "`GDScript` overrides (.gd)",
          "anyOf": [
            {
              "$ref": "#/$defs/PartialThresholds"
            },
            {
              "type": "null"
            }
          ]
        },
        "go": {
          "description": "`Go` overrides (.go)",
          "anyOf": [
            {
              "$ref": "#/$defs/PartialThresholds"
            },
            {
              "type": "null"
            }
          ]
        },
        "java": {
          "description": "Java overrides (.java)",
          "anyOf": [
            {
              "$ref": "#/$defs/PartialThresholds"
            },
            {
              "type": "null"
            }
          ]
        },
        "js": {
          "description": "JavaScript overrides (.js, .mjs, .cjs)",
          "anyOf": [
            {
              "$ref": "#/$defs/PartialThresholds"
            },
            {
              "type": "null"
            }
          ]
        },
        "lua": {
          "description": "`Lua` overrides (.lua)",
          "anyOf": [
            {
              "$ref": "#/$defs/PartialThresholds"
            },
            {
              "type": "null"
            }
          ]
        },
        "php": {
          "description": "`PHP` overrides (.php)",
          "anyOf": [
            {
              "$ref": "#/$defs/PartialThresholds"
            },
            {
              "type": "null"
            }
          ]
        },
        "py": {
          "description": "Python overrides (.py)",
          "anyOf": [
            {
              "$ref": "#/$defs/PartialThresholds"
            },
            {
              "type": "null"
            }
          ]
        },
        "rs": {
          "description": "Rust overrides (.rs)",
          "anyOf": [
            {
              "$ref": "#/$defs/PartialThresholds"
            },
            {
              "type": "null"
            }
          ]
        },
        "ts": {
          "description": "TypeScript overrides (.ts, .tsx)G",
          "anyOf": [
            {
              "$ref": "#/$defs/PartialThresholds"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": {
        "$ref": "#/$defs/PartialThresholds"
      }
    }
  }
}