PascalHonegger/M151

View on GitHub

Showing 11 of 137 total issues

Function applySettings has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function applySettings() {
    var username = $("#Username").val();
    var name = $("#Name").val();
    var surname = $("#Surname").val();
    var mail = $("#Mail").val();
Severity: Minor
Found in EditSettings/EditSettingsScript.js - About 1 hr to fix

    Method __construct has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function __construct(array $location)
        {
            echo '
            <div id="' . $location['id_location'] . '" class="contentLocation">
                <table style="width:100%" class="table" onclick="openlocation(' . $location['id_location'] . ', \'' . $location['name'] . '\')">
    Severity: Minor
    Found in Discover/DiscoverRowBuilder.php - About 1 hr to fix

      Function createLocation has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function createLocation() {
          var genericFormData = new FormData($("form")[1]);
      
          $.ajax({
              type: "POST",
      Severity: Minor
      Found in Location/CreateLocationScript.js - About 1 hr to fix

        Method updateSettings has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function updateSettings(string $newUsername, string $newName, string $newSurname, string $newMail, string $newPassword, string $newRepPassword, string $secret, string $authenticatorCode)
        Severity: Major
        Found in EditSettings/EditSettingsController.php - About 1 hr to fix

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

              public function createLocation(int $idCreator, string $name, string $description, string $position){
                  if (strlen($name) < 50 && strlen($name) > 1 && strlen($description) < 100 && strlen($description) > 1) {
                      $inserted = $this->model->creatLocation($idCreator, $name, $description, $position);
          
                      if($inserted){
          Severity: Minor
          Found in Location/LocationController.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 registerPerson has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function registerPerson(string $username, string $password, string $repeatPassword, string $surname, string $name, string $mail)
          Severity: Minor
          Found in Login/RegisterController.php - About 45 mins to fix

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

                public static function inputValid(string $username, string $password, string $repeatPassword, string $surname, string $name, string $mail)
            Severity: Minor
            Found in Login/RegisterController.php - About 45 mins to fix

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

                  public function update(string $username, string $name, string $surname, string $mail, $password, $secret)
              Severity: Minor
              Found in model/EditSettingsModel.php - About 45 mins to fix

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

                    public function insert(string $username, string $password, string $surname, string $name, string $mail)
                Severity: Minor
                Found in model/RegisterModel.php - About 35 mins to fix

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

                      public function loginPerson(string $username, string $password, string $googleAuthCode)
                      {
                          $user = $this->model->load($username);
                  
                          $passwordCorrect = password_verify($password, $user['password']);
                  Severity: Minor
                  Found in Login/LoginController.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 registerPerson has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function registerPerson(string $username, string $password, string $repeatPassword, string $surname, string $name, string $mail)
                      {
                          $validationResults = $this->inputValid($username, $password, $repeatPassword, $surname, $name, $mail);
                  
                          $allValid = true;
                  Severity: Minor
                  Found in Login/RegisterController.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