panique/huge

View on GitHub

Showing 37 of 37 total issues

Function validatePasswordChange has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public static function validatePasswordChange($user_name, $user_password_current, $user_password_new, $user_password_repeat)
    {
        $database = DatabaseFactory::getFactory()->getConnection();

        $sql = "SELECT user_password_hash, user_failed_logins FROM users WHERE user_name = :user_name LIMIT 1;";
Severity: Minor
Found in application/model/PasswordResetModel.php - About 3 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 validateResetPassword has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public static function validateResetPassword($user_name, $user_password_reset_hash, $user_password_new, $user_password_repeat)
    {
        if (empty($user_name)) {
            Session::add('feedback_negative', Text::get('FEEDBACK_USERNAME_FIELD_EMPTY'));
            return false;
Severity: Minor
Found in application/model/PasswordResetModel.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 registerNewUser has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function registerNewUser()
    {
        // clean the input
        $user_name = strip_tags(Request::post('user_name'));
        $user_email = strip_tags(Request::post('user_email'));
Severity: Minor
Found in application/model/RegistrationModel.php - About 1 hr to fix

    Method validatePasswordChange has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function validatePasswordChange($user_name, $user_password_current, $user_password_new, $user_password_repeat)
        {
            $database = DatabaseFactory::getFactory()->getConnection();
    
            $sql = "SELECT user_password_hash, user_failed_logins FROM users WHERE user_name = :user_name LIMIT 1;";
    Severity: Minor
    Found in application/model/PasswordResetModel.php - About 1 hr to fix

      Method resizeAvatarImage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function resizeAvatarImage($source_image, $destination, $final_width = 44, $final_height = 44)
          {
              $imageData = getimagesize($source_image);
              $width = $imageData[0];
              $height = $imageData[1];
      Severity: Minor
      Found in application/model/AvatarModel.php - About 1 hr to fix

        Method sendMailWithPHPMailer has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function sendMailWithPHPMailer($user_email, $from_email, $from_name, $subject, $body)
            {
                $mail = new PHPMailer;
                
                // you should use UTF-8 to avoid encoding issues
        Severity: Minor
        Found in application/core/Mail.php - About 1 hr to fix

          Method login has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function login($user_name, $user_password, $set_remember_me_cookie = null)
              {
                  // we do negative-first checks here, for simplicity empty username and empty password in one line
                  if (empty($user_name) OR empty($user_password)) {
                      Session::add('feedback_negative', Text::get('FEEDBACK_USERNAME_OR_PASSWORD_FIELD_EMPTY'));
          Severity: Minor
          Found in application/model/LoginModel.php - About 1 hr to fix

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

                public function login()
                {
                    // check if csrf token is valid
                    if (!Csrf::isTokenValid()) {
                        LoginModel::logout();
            Severity: Minor
            Found in application/controller/LoginController.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 resizeAvatarImage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function resizeAvatarImage($source_image, $destination, $final_width = 44, $final_height = 44)
                {
                    $imageData = getimagesize($source_image);
                    $width = $imageData[0];
                    $height = $imageData[1];
            Severity: Minor
            Found in application/model/AvatarModel.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 __construct has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public function __construct()
                {
                    // create array with URL parts in $url
                    $this->splitUrl();
            
            
            Severity: Minor
            Found in application/core/Application.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

            Method registrationInputValidation has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public static function registrationInputValidation($captcha, $user_name, $user_password_new, $user_password_repeat, $user_email, $user_email_repeat)
            Severity: Minor
            Found in application/model/RegistrationModel.php - About 45 mins to fix

              Function XSSFilter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function XSSFilter(&$value)
                  {
                      // if argument is a string, filters that string
                      if (is_string($value)) {
                          $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
              Severity: Minor
              Found in application/core/Filter.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 sendMail has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function sendMail($user_email, $from_email, $from_name, $subject, $body)
              Severity: Minor
              Found in application/core/Mail.php - About 35 mins to fix

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

                    public function sendMailWithPHPMailer($user_email, $from_email, $from_name, $subject, $body)
                Severity: Minor
                Found in application/core/Mail.php - About 35 mins to fix

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

                      public static function writeNewUserToDatabase($user_name, $user_password_hash, $user_email, $user_creation_timestamp, $user_activation_hash)
                  Severity: Minor
                  Found in application/model/RegistrationModel.php - About 35 mins to fix

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

                        public static function login($user_name, $user_password, $set_remember_me_cookie = null)
                        {
                            // we do negative-first checks here, for simplicity empty username and empty password in one line
                            if (empty($user_name) OR empty($user_password)) {
                                Session::add('feedback_negative', Text::get('FEEDBACK_USERNAME_OR_PASSWORD_FIELD_EMPTY'));
                    Severity: Minor
                    Found in application/model/LoginModel.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

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

                        public static function registerNewUser()
                        {
                            // clean the input
                            $user_name = strip_tags(Request::post('user_name'));
                            $user_email = strip_tags(Request::post('user_email'));
                    Severity: Minor
                    Found in application/model/RegistrationModel.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 $result;
                    Severity: Major
                    Found in application/model/LoginModel.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return false;
                      Severity: Major
                      Found in application/model/PasswordResetModel.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return false;
                        Severity: Major
                        Found in application/model/PasswordResetModel.php - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language