cloudfoundry/stratos

View on GitHub
src/frontend/packages/core/src/features/login/login-page/login-page.component.ts

Summary

Maintainability
A
3 hrs
Test Coverage

Function ngOnInit has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  ngOnInit() {
    this.ssoLogin = false;
    this.store.dispatch(new VerifySession());
    const auth$ = this.store.select(s => ({ auth: s.auth, endpoints: s.endpoints }));
    this.initialLoad$ = auth$.pipe(

    Function handleOther has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private handleOther(auth: AuthState) {
        this.loggedIn = auth.loggedIn;
        this.loggingIn = auth.loggingIn;
        this.isLoginFlow = this.isLoginFlow || auth.loggingIn;
        this.verifying = auth.verifying;

      Function setErrorMessage has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
      Open

        private setErrorMessage(auth: AuthState) {
          // Default error message
          this.message = `Couldn't log in, please try again.`;
          if (auth.error && auth.errorResponse) {
            if (auth.errorResponse === 'Invalid session') {

      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

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

        private handleOther(auth: AuthState) {
          this.loggedIn = auth.loggedIn;
          this.loggingIn = auth.loggingIn;
          this.isLoginFlow = this.isLoginFlow || auth.loggingIn;
          this.verifying = auth.verifying;

      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