Angular Modernizer
    Preparing search index...

    OCP Violation Rule (solid:ocp-violation) - detects code that has to be modified for new features (Open/Closed Principle violation).

    Detection patterns in class methods (violationType in the metadata):

    • large-switch-statement: switch statements with more than 5 cases
    • long-if-else-chain: if/else chains with more than 4 branches
    • too-many-parameters: methods with more than 4 parameters
    // Violation: requires modification for each new shape type
    function createShape(type: string) {
    switch (type) {
    case 'circle': return new Circle();
    case 'square': return new Square();
    // Every new shape requires editing this function
    }
    }

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

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

    Rule category for grouping.

    description: "Detects code that violates the Open/Closed Principle" = 'Detects code that violates the Open/Closed Principle'

    Rule description explaining what it checks.

    id: "solid:ocp-violation" = 'solid:ocp-violation'

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

    name: "Open/Closed Principle Violation" = 'Open/Closed Principle Violation'

    Human-readable rule name.

    severity: "warning" = 'warning'

    Rule severity level.

    tags: string[] = ...

    Tags for filtering and search.

    Methods