wikimedia/mediawiki-core

View on GitHub
includes/auth/AuthManager.php

Summary

Maintainability
F
2 wks
Test Coverage

File AuthManager.php has 1809 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Authentication (and possibly Authorization in the future) system entry point
 *
 * This program is free software; you can redistribute it and/or modify
Severity: Major
Found in includes/auth/AuthManager.php - About 4 days to fix

    Method continueAccountCreation has 326 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function continueAccountCreation( array $reqs ) {
            $session = $this->request->getSession();
            try {
                if ( !$this->canCreateAccounts() ) {
                    // Caller should have called canCreateAccounts()
    Severity: Major
    Found in includes/auth/AuthManager.php - About 1 day to fix

      Method continueAuthentication has 279 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function continueAuthentication( array $reqs ) {
              $session = $this->request->getSession();
              try {
                  if ( !$session->canSetUser() ) {
                      // Caller should have called canAuthenticateNow()
      Severity: Major
      Found in includes/auth/AuthManager.php - About 1 day to fix

        Function continueAuthentication has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
        Open

            public function continueAuthentication( array $reqs ) {
                $session = $this->request->getSession();
                try {
                    if ( !$session->canSetUser() ) {
                        // Caller should have called canAuthenticateNow()
        Severity: Minor
        Found in includes/auth/AuthManager.php - About 1 day to fix

        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 continueAccountCreation has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
        Open

            public function continueAccountCreation( array $reqs ) {
                $session = $this->request->getSession();
                try {
                    if ( !$this->canCreateAccounts() ) {
                        // Caller should have called canCreateAccounts()
        Severity: Minor
        Found in includes/auth/AuthManager.php - About 1 day to fix

        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

        Method autoCreateUser has 200 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function autoCreateUser(
                User $user,
                $source,
                $login = true,
                $log = true,
        Severity: Major
        Found in includes/auth/AuthManager.php - About 1 day to fix

          AuthManager has 44 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class AuthManager implements LoggerAwareInterface {
              /**
               * @internal
               * Key in the user's session data for storing login state.
               */
          Severity: Minor
          Found in includes/auth/AuthManager.php - About 6 hrs to fix

            Function autoCreateUser has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

                public function autoCreateUser(
                    User $user,
                    $source,
                    $login = true,
                    $log = true,
            Severity: Minor
            Found in includes/auth/AuthManager.php - About 5 hrs to fix

            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

            Method beginAuthentication has 88 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function beginAuthentication( array $reqs, $returnToUrl ) {
                    $session = $this->request->getSession();
                    if ( !$session->canSetUser() ) {
                        // Caller should have called canAuthenticateNow()
                        $session->remove( self::AUTHN_STATE );
            Severity: Major
            Found in includes/auth/AuthManager.php - About 3 hrs to fix

              Method beginAccountLink has 85 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function beginAccountLink( User $user, array $reqs, $returnToUrl ) {
                      $session = $this->request->getSession();
                      $session->remove( self::ACCOUNT_LINK_STATE );
              
                      if ( !$this->canLinkAccounts() ) {
              Severity: Major
              Found in includes/auth/AuthManager.php - About 3 hrs to fix

                Method beginAccountCreation has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function beginAccountCreation( Authority $creator, array $reqs, $returnToUrl ) {
                        $session = $this->request->getSession();
                        if ( !$this->canCreateAccounts() ) {
                            // Caller should have called canCreateAccounts()
                            $session->remove( self::ACCOUNT_CREATION_STATE );
                Severity: Major
                Found in includes/auth/AuthManager.php - About 3 hrs to fix

                  Method continueAccountLink has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function continueAccountLink( array $reqs ) {
                          $session = $this->request->getSession();
                          try {
                              if ( !$this->canLinkAccounts() ) {
                                  // Caller should have called canLinkAccounts()
                  Severity: Major
                  Found in includes/auth/AuthManager.php - About 3 hrs to fix

                    Function beginAuthentication has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function beginAuthentication( array $reqs, $returnToUrl ) {
                            $session = $this->request->getSession();
                            if ( !$session->canSetUser() ) {
                                // Caller should have called canAuthenticateNow()
                                $session->remove( self::AUTHN_STATE );
                    Severity: Minor
                    Found in includes/auth/AuthManager.php - About 2 hrs to fix

                    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 securitySensitiveOperationStatus has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function securitySensitiveOperationStatus( $operation ) {
                            $status = self::SEC_OK;
                    
                            $this->logger->debug( __METHOD__ . ": Checking $operation" );
                    
                    
                    Severity: Minor
                    Found in includes/auth/AuthManager.php - About 2 hrs to fix

                    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

                    Method securitySensitiveOperationStatus has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function securitySensitiveOperationStatus( $operation ) {
                            $status = self::SEC_OK;
                    
                            $this->logger->debug( __METHOD__ . ": Checking $operation" );
                    
                    
                    Severity: Major
                    Found in includes/auth/AuthManager.php - About 2 hrs to fix

                      Function getAuthenticationRequestsInternal has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function getAuthenticationRequestsInternal(
                              $providerAction, array $options, array $providers, UserIdentity $user = null
                          ) {
                              $user = $user ?: RequestContext::getMain()->getUser();
                              $options['username'] = $user->isRegistered() ? $user->getName() : null;
                      Severity: Minor
                      Found in includes/auth/AuthManager.php - About 2 hrs to fix

                      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 beginAccountLink has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function beginAccountLink( User $user, array $reqs, $returnToUrl ) {
                              $session = $this->request->getSession();
                              $session->remove( self::ACCOUNT_LINK_STATE );
                      
                              if ( !$this->canLinkAccounts() ) {
                      Severity: Minor
                      Found in includes/auth/AuthManager.php - About 1 hr to fix

                      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

                      Method __construct has 15 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              WebRequest $request,
                              Config $config,
                              ObjectFactory $objectFactory,
                              HookContainer $hookContainer,
                              ReadOnlyMode $readOnlyMode,
                      Severity: Major
                      Found in includes/auth/AuthManager.php - About 1 hr to fix

                        Method getAuthenticationRequests has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getAuthenticationRequests( $action, UserIdentity $user = null ) {
                                $options = [];
                                $providerAction = $action;
                        
                                // Figure out which providers to query
                        Severity: Minor
                        Found in includes/auth/AuthManager.php - About 1 hr to fix

                          Function beginAccountCreation has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function beginAccountCreation( Authority $creator, array $reqs, $returnToUrl ) {
                                  $session = $this->request->getSession();
                                  if ( !$this->canCreateAccounts() ) {
                                      // Caller should have called canCreateAccounts()
                                      $session->remove( self::ACCOUNT_CREATION_STATE );
                          Severity: Minor
                          Found in includes/auth/AuthManager.php - About 1 hr to fix

                          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

                          Method getAuthenticationRequestsInternal has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function getAuthenticationRequestsInternal(
                                  $providerAction, array $options, array $providers, UserIdentity $user = null
                              ) {
                                  $user = $user ?: RequestContext::getMain()->getUser();
                                  $options['username'] = $user->isRegistered() ? $user->getName() : null;
                          Severity: Minor
                          Found in includes/auth/AuthManager.php - About 1 hr to fix

                            Method forcePrimaryAuthenticationProviders has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function forcePrimaryAuthenticationProviders( array $providers, $why ) {
                                    $this->logger->warning( "Overriding AuthManager primary authn because $why" );
                            
                                    if ( $this->primaryAuthenticationProviders !== null ) {
                                        $this->logger->warning(
                            Severity: Minor
                            Found in includes/auth/AuthManager.php - About 1 hr to fix

                              Method canCreateAccount has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function canCreateAccount( $username, $options = [] ) {
                                      // Back compat
                                      if ( is_int( $options ) ) {
                                          $options = [ 'flags' => $options ];
                                      }
                              Severity: Minor
                              Found in includes/auth/AuthManager.php - About 1 hr to fix

                                Function getAuthenticationRequests has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function getAuthenticationRequests( $action, UserIdentity $user = null ) {
                                        $options = [];
                                        $providerAction = $action;
                                
                                        // Figure out which providers to query
                                Severity: Minor
                                Found in includes/auth/AuthManager.php - About 1 hr to fix

                                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 canCreateAccount has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function canCreateAccount( $username, $options = [] ) {
                                        // Back compat
                                        if ( is_int( $options ) ) {
                                            $options = [ 'flags' => $options ];
                                        }
                                Severity: Minor
                                Found in includes/auth/AuthManager.php - About 1 hr to fix

                                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 continueAccountLink has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function continueAccountLink( array $reqs ) {
                                        $session = $this->request->getSession();
                                        try {
                                            if ( !$this->canLinkAccounts() ) {
                                                // Caller should have called canLinkAccounts()
                                Severity: Minor
                                Found in includes/auth/AuthManager.php - About 45 mins to fix

                                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

                                Method autoCreateUser has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                        User $user,
                                        $source,
                                        $login = true,
                                        $log = true,
                                        ?Authority $performer = null
                                Severity: Minor
                                Found in includes/auth/AuthManager.php - About 35 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                      return $ret;
                                  Severity: Major
                                  Found in includes/auth/AuthManager.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                            return $ret;
                                    Severity: Major
                                    Found in includes/auth/AuthManager.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                              return null;
                                      Severity: Major
                                      Found in includes/auth/AuthManager.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                return Status::newGood();
                                        Severity: Major
                                        Found in includes/auth/AuthManager.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                              return $ret;
                                          Severity: Major
                                          Found in includes/auth/AuthManager.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                    return $this->continueAccountCreation( $reqs );
                                            Severity: Major
                                            Found in includes/auth/AuthManager.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                                      return $res;
                                              Severity: Major
                                              Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                                    return $ret;
                                                Severity: Major
                                                Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                                  return $ret;
                                                  Severity: Major
                                                  Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                        return $res;
                                                    Severity: Major
                                                    Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                      return Status::wrap( $status );
                                                      Severity: Major
                                                      Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                                return $res;
                                                        Severity: Major
                                                        Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                                  return $res;
                                                          Severity: Major
                                                          Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                                        return $res;
                                                            Severity: Major
                                                            Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                          return Status::newFatal( 'authmanager-autocreate-exception' );
                                                              Severity: Major
                                                              Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                        return Status::newGood();
                                                                Severity: Major
                                                                Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                                          return $ret;
                                                                  Severity: Major
                                                                  Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                        return $ret;
                                                                    Severity: Major
                                                                    Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                      return $ret;
                                                                      Severity: Major
                                                                      Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                            return $ret;
                                                                        Severity: Major
                                                                        Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                              return $res;
                                                                          Severity: Major
                                                                          Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                                return $ret;
                                                                            Severity: Major
                                                                            Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                                  return $res;
                                                                              Severity: Major
                                                                              Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                            return $ret;
                                                                                Severity: Major
                                                                                Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                                          return $res;
                                                                                  Severity: Major
                                                                                  Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                return $ret;
                                                                                    Severity: Major
                                                                                    Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                      return $status;
                                                                                      Severity: Major
                                                                                      Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                            return $ret;
                                                                                        Severity: Major
                                                                                        Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                                      return $res;
                                                                                          Severity: Major
                                                                                          Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                        return Status::newFatal( 'usernameinprogress' );
                                                                                            Severity: Major
                                                                                            Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                                              Avoid too many return statements within this method.
                                                                                              Open

                                                                                                                      return $ret;
                                                                                              Severity: Major
                                                                                              Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                                                Avoid too many return statements within this method.
                                                                                                Open

                                                                                                                        return $res;
                                                                                                Severity: Major
                                                                                                Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                                                  Avoid too many return statements within this method.
                                                                                                  Open

                                                                                                              return Status::newFatal( 'noname' );
                                                                                                  Severity: Major
                                                                                                  Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                                                    Avoid too many return statements within this method.
                                                                                                    Open

                                                                                                                            return $res;
                                                                                                    Severity: Major
                                                                                                    Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                                                      Avoid too many return statements within this method.
                                                                                                      Open

                                                                                                                              return $res;
                                                                                                      Severity: Major
                                                                                                      Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                                                        Avoid too many return statements within this method.
                                                                                                        Open

                                                                                                                        return Status::wrap( $status );
                                                                                                        Severity: Major
                                                                                                        Found in includes/auth/AuthManager.php - About 30 mins to fix

                                                                                                          Function forcePrimaryAuthenticationProviders has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                          Open

                                                                                                              public function forcePrimaryAuthenticationProviders( array $providers, $why ) {
                                                                                                                  $this->logger->warning( "Overriding AuthManager primary authn because $why" );
                                                                                                          
                                                                                                                  if ( $this->primaryAuthenticationProviders !== null ) {
                                                                                                                      $this->logger->warning(
                                                                                                          Severity: Minor
                                                                                                          Found in includes/auth/AuthManager.php - About 25 mins to fix

                                                                                                          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

                                                                                                          Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                                              case AuthenticationResponse::FAIL:
                                                                                                                                  $this->logger->debug( "Login failed in primary authentication by $id" );
                                                                                                                                  if ( $res->createRequest || $state['maybeLink'] ) {
                                                                                                                                      $res->createRequest = new CreateFromLoginAuthenticationRequest(
                                                                                                                                          $res->createRequest, $state['maybeLink']
                                                                                                          Severity: Major
                                                                                                          Found in includes/auth/AuthManager.php and 1 other location - About 2 hrs to fix
                                                                                                          includes/auth/AuthManager.php on lines 573..593

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 141.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                                                  case AuthenticationResponse::FAIL:
                                                                                                                                      $this->logger->debug( "Login failed in primary authentication by $id" );
                                                                                                                                      if ( $res->createRequest || $state['maybeLink'] ) {
                                                                                                                                          $res->createRequest = new CreateFromLoginAuthenticationRequest(
                                                                                                                                              $res->createRequest, $state['maybeLink']
                                                                                                          Severity: Major
                                                                                                          Found in includes/auth/AuthManager.php and 1 other location - About 2 hrs to fix
                                                                                                          includes/auth/AuthManager.php on lines 648..663

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 141.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              public function __construct(
                                                                                                                  WebRequest $request,
                                                                                                                  Config $config,
                                                                                                                  ObjectFactory $objectFactory,
                                                                                                                  HookContainer $hookContainer,
                                                                                                          Severity: Major
                                                                                                          Found in includes/auth/AuthManager.php and 2 other locations - About 1 hr to fix
                                                                                                          includes/Permissions/PermissionManager.php on lines 283..316
                                                                                                          includes/page/UndeletePage.php on lines 126..159

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 106.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                                          if ( $user->isRegistered() ) {
                                                                                                                              $this->logger->debug( __METHOD__ . ': User exists locally', [
                                                                                                                                  'user' => $user->getName(),
                                                                                                                                  'creator' => $creator->getName(),
                                                                                                                              ] );
                                                                                                          Severity: Minor
                                                                                                          Found in includes/auth/AuthManager.php and 1 other location - About 50 mins to fix
                                                                                                          includes/auth/AuthManager.php on lines 1534..1545

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 97.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                                          if ( $state['primary'] === null ) {
                                                                                                                              $this->logger->debug( __METHOD__ . ': Primary creation failed because no provider accepted', [
                                                                                                                                  'user' => $user->getName(),
                                                                                                                                  'creator' => $creator->getName(),
                                                                                                                              ] );
                                                                                                          Severity: Minor
                                                                                                          Found in includes/auth/AuthManager.php and 1 other location - About 50 mins to fix
                                                                                                          includes/auth/AuthManager.php on lines 1402..1411

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 97.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          There are no issues that match your filters.

                                                                                                          Category
                                                                                                          Status