Angular Modernizer
    Preparing search index...

    God Switch Analysis Rule (solid:god-switch) - detects switch statements with too many cases (Open/Closed Principle violation).

    Reports every switch statement with more case clauses (excluding default) than the threshold. The threshold is read from context.config.solid.godSwitch.maxCases (default: 10). Each result carries the case count, a classification of the switch expression (switchType) and a confidence score. Recommended refactorings: factory with strategy objects, polymorphism, strategy or command pattern; GodSwitchTransformRule applies the factory variant.

    // Violation: switch with too many cases exceeds threshold
    function handleAction(action: string) {
    switch (action) {
    case 'create': return onCreate();
    case 'read': return onRead();
    // 9+ additional cases - "God Switch" pattern
    }
    }

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    category: "solid-violation" = 'solid-violation'

    Rule category for grouping.

    description: "Detects switch statements with too many cases that violate OCP (configurable threshold, default: 10)" = 'Detects switch statements with too many cases that violate OCP (configurable threshold, default: 10)'

    Rule description explaining what it checks.

    id: "solid:god-switch" = 'solid:god-switch'

    Unique rule identifier (scoped to plugin). Format: "plugin-name:rule-name" (e.g., "angular-standalone:component-not-standalone")

    name: "God Switch Detection" = 'God Switch Detection'

    Human-readable rule name.

    severity: "warning" = 'warning'

    Rule severity level.

    tags: string[] = ...

    Tags for filtering and search.

    Methods