CORE-POS/IS4C

View on GitHub
fannie/auth/login.php

Summary

Maintainability
D
2 days
Test Coverage
F
9%

File login.php has 318 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*******************************************************************************

    Copyright 2009 Whole Foods Co-op

Severity: Minor
Found in fannie/auth/login.php - About 3 hrs to fix

    Method createLogin has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function createLogin($name,$password){
        // 10Nov12 EL Add FANNIE_AUTH_ENABLED
        global $FANNIE_AUTH_ENABLED;
      if (!isAlphanumeric($name) ){
        //echo 'failed alphanumeric';
    Severity: Minor
    Found in fannie/auth/login.php - About 1 hr to fix

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

      function createLogin($name,$password){
          // 10Nov12 EL Add FANNIE_AUTH_ENABLED
          global $FANNIE_AUTH_ENABLED;
        if (!isAlphanumeric($name) ){
          //echo 'failed alphanumeric';
      Severity: Minor
      Found in fannie/auth/login.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 checkLogin has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function checkLogin(){
        if (!auth_enabled()) return 'null';
      
        if (init_check())
          return 'init';
      Severity: Minor
      Found in fannie/auth/login.php - About 1 hr to fix

        Function ldap_login has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        function ldap_login($name,$passwd)
        {
            $config = FannieConfig::factory();
            if (!isAlphanumeric($name))
                return false;
        Severity: Minor
        Found in fannie/auth/login.php - About 55 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

        Function migratePass has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function migratePass($name, $password) {
            $hashed = password_hash($password, PASSWORD_DEFAULT);
            if (password_verify($password, $hashed)) {
                $dbc = dbconnect();
                $table = $dbc->detailedDefinition('Users');
        Severity: Minor
        Found in fannie/auth/login.php - About 35 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

        Avoid too many return statements within this method.
        Open

            if (!$search_result) return false;
        Severity: Major
        Found in fannie/auth/login.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return false;
          Severity: Major
          Found in fannie/auth/login.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return false;
            Severity: Major
            Found in fannie/auth/login.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                     return false;
              Severity: Major
              Found in fannie/auth/login.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                    return false;
                Severity: Major
                Found in fannie/auth/login.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                      return false;
                  Severity: Major
                  Found in fannie/auth/login.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                      return $checkW['username'];
                    Severity: Major
                    Found in fannie/auth/login.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                             return false;
                      Severity: Major
                      Found in fannie/auth/login.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                             return $current_user;
                        Severity: Major
                        Found in fannie/auth/login.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  return false;
                          Severity: Major
                          Found in fannie/auth/login.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                return true;
                            Severity: Major
                            Found in fannie/auth/login.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                return $name;
                              Severity: Major
                              Found in fannie/auth/login.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                     return $current_user;
                                Severity: Major
                                Found in fannie/auth/login.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                    return true;
                                  Severity: Major
                                  Found in fannie/auth/login.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                        return false;
                                    Severity: Major
                                    Found in fannie/auth/login.php - About 30 mins to fix

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

                                      function checkLogin(){
                                        if (!auth_enabled()) return 'null';
                                      
                                        if (init_check())
                                          return 'init';
                                      Severity: Minor
                                      Found in fannie/auth/login.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

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

                                      function checkPass($password, $crypt_pass, $salt, $name) {
                                          if (!function_exists('password_hash')) {
                                              return crypt($password, $salt) == $crypt_pass;
                                          } elseif (!empty($salt)) {
                                              if (crypt($password, $salt) == $crypt_pass) {
                                      Severity: Minor
                                      Found in fannie/auth/login.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

                                      There are no issues that match your filters.

                                      Category
                                      Status