Angular Modernizer
    Preparing search index...

    SRP Violation Rule (solid:srp-single-responsibility-violation) - detects Single Responsibility Principle violations in classes.

    Detection patterns (violationType in the metadata):

    • too-many-methods: classes with more than 15 callable members. Get/set accessors (a pair counts once) and arrow-function / function-expression properties count as methods.
    • mixed-responsibilities: member names that fall into 3 or more responsibility categories. Base classes (abstract, or extended by 3 or more classes in the project) with at least 8 public/protected callable members are flagged at 2 categories, since every subclass inherits all concerns; metadata then carries isBaseClass, isAbstract and subclassCount.
    • single-method-multi-concern: a method of 20 or more lines whose body touches 4 or more categories.

    Responsibility categories are matched by keywords: UI, Business, HTTP, Data, Event and Lifecycle.

    // Violation: class mixes HTTP, business, and UI concerns
    class UserComponent {
    fetchUsers() {} // HTTP concern
    calculateTotal() {} // Business concern
    renderChart() {} // UI concern
    }

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

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

    Rule category for grouping.

    description: "Detects classes with too many methods or mixed responsibilities" = 'Detects classes with too many methods or mixed responsibilities'

    Rule description explaining what it checks.

    id: "solid:srp-single-responsibility-violation" = 'solid:srp-single-responsibility-violation'

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

    name: "Single Responsibility Principle Violation" = 'Single Responsibility Principle Violation'

    Human-readable rule name.

    severity: "warning" = 'warning'

    Rule severity level.

    tags: string[] = ...

    Tags for filtering and search.

    Methods