ircmaxell/password_compat

View on GitHub

Showing 10 of 10 total issues

Function password_hash has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
Open

        function password_hash($password, $algo, array $options = array()) {
            if (!function_exists('crypt')) {
                trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING);
                return null;
            }
Severity: Minor
Found in lib/password.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 password_hash has 120 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function password_hash($password, $algo, array $options = array()) {
            if (!function_exists('crypt')) {
                trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING);
                return null;
            }
Severity: Major
Found in lib/password.php - About 4 hrs to fix

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

            function password_verify($password, $hash) {
                if (!function_exists('crypt')) {
                    trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING);
                    return false;
                }
    Severity: Minor
    Found in lib/password.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

                        return null;
    Severity: Major
    Found in lib/password.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return $ret;
      Severity: Major
      Found in lib/password.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                            return null;
        Severity: Major
        Found in lib/password.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                                  return null;
          Severity: Major
          Found in lib/password.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return false;
            Severity: Major
            Found in lib/password.php - About 30 mins to fix

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

                      function check() {
                          static $pass = NULL;
              
                          if (is_null($pass)) {
                              if (function_exists('crypt')) {
              Severity: Minor
              Found in lib/password.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 password_needs_rehash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                      function password_needs_rehash($hash, $algo, array $options = array()) {
                          $info = password_get_info($hash);
                          if ($info['algo'] !== (int) $algo) {
                              return true;
                          }
              Severity: Minor
              Found in lib/password.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

              Severity
              Category
              Status
              Source
              Language