Skip to content

[@angular-eslint/template/cyclomatic-complexity] Take into consideration new Angular control flows when calculating cyclomatic complexity #2252

Closed
@paperez

Description

@paperez

Description and reproduction of the issue

The current implementation of the @angular-eslint/template/cyclomatic-complexity rule does not take into consideration Angular 17's new control flow syntax (e.g. @switch, @case, @default, @if, and @for). As a result, templates that are refactored using these new control flow directives may appear to have a lower (or sometimes inconsistent) cyclomatic complexity according to the rule, even though the logical decision points in the template remain unchanged.

Versions

package version
@angular-eslint/eslint-plugin 18.1.0
@angular-eslint/eslint-plugin-template 18.1.0
@angular-eslint/template-parser 18.1.0
@typescript-eslint/parser 7.17.0
ESLint 8.57.0
node 22.12.0
Angular CLI: 18.2.12
Node: 22.12.0
Package Manager: npm 10.9.0
OS: darwin arm64

Angular: 18.2.9
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.9
@angular-devkit/build-angular   18.2.9
@angular-devkit/core            18.2.12
@angular-devkit/schematics      18.2.12
@angular/cli                    18.2.12
@angular/fire                   18.0.1
@schematics/angular             18.2.9
ng-packagr                      18.1.0
rxjs                            7.8.1
typescript                      5.5.4
webpack                         5.97.1
zone.js                         0.14.10
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest supported version of the packages and checked my ng version output per the instructions given here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    PRs WelcomeIf a high-quality PR is created for this it will be acceptedbugSomething isn't workingpackage: eslint-plugin-templateAngular Template rules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions