cloudfoundry/stratos

View on GitHub
src/frontend/packages/cloud-foundry/src/shared/components/cf-role-checkbox/cf-role-checkbox.component.ts

Summary

Maintainability
A
2 hrs
Test Coverage

File cf-role-checkbox.component.ts has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import { Component, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { Store } from '@ngrx/store';
import { BehaviorSubject, combineLatest, Observable, Subscription } from 'rxjs';
import { combineLatest as combineLatestOp, filter, first, map } from 'rxjs/operators';

    Function ngOnInit has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Wontfix

      ngOnInit() {
        this.isOrgRole = !this.spaceGuid;
        const users$ = this.store.select(selectCfUsersRolesPicked);
        // If setting an org role user must be admin or org manager.
        // If setting a space role user must be admin, org manager or space manager

      Function getCheckedState has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private static getCheckedState(
          role: string,
          users: CfUser[],
          existingRoles: CfUserRolesSelected,
          newRoles: IUserPermissionInOrg,

        Avoid too many return statements within this function.
        Open

            return false;

          Function getCheckedState has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
          Open

            private static getCheckedState(
              role: string,
              users: CfUser[],
              existingRoles: CfUserRolesSelected,
              newRoles: IUserPermissionInOrg,

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          There are no issues that match your filters.

          Category
          Status