Showing 599 of 599 total issues

File API.php has 417 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * *****************************************************************************
 * Contributions to this work were made on behalf of the GÉANT project, a 
Severity: Minor
Found in web/lib/admin/API.php - About 6 hrs to fix

    File DeviceVista7.php has 416 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*
     * *****************************************************************************
     * Contributions to this work were made on behalf of the GÉANT project, a 
     * project that has received funding from the European Union’s Framework 
    Severity: Minor
    Found in devices/ms/DeviceVista7.php - About 6 hrs to fix

      Function tlsClientSideCheck has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

          public function tlsClientSideCheck(string $host, string $ename, string $realm)
          {
              $res = RADIUSTests::RETVAL_OK;
              if (!is_array(\config\Diagnostics::RADIUSTESTS['TLS-clientcerts']) || count(\config\Diagnostics::RADIUSTESTS['TLS-clientcerts']) == 0) {
                  return RADIUSTests::RETVAL_SKIPPED;
      Severity: Minor
      Found in core/diag/RFC6614Tests.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

      File UserAPI.php has 383 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /*
       * *****************************************************************************
       * Contributions to this work were made on behalf of the GÉANT project, a 
      Severity: Minor
      Found in core/UserAPI.php - About 5 hrs to fix

        File DeploymentManaged.php has 381 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /*
         * *****************************************************************************
         * Contributions to this work were made on behalf of the GÉANT project, a 
        Severity: Minor
        Found in core/DeploymentManaged.php - About 5 hrs to fix

          Method signRequest has 125 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function signRequest($csr, $expiryDays): array
              {
                  if ($csr["CSR_STRING"] === NULL) {
                      throw new Exception("This CA needs the CSR in a string (PEM)!");
                  }
          Severity: Major
          Found in core/CertificationAuthorityEduPki.php - About 5 hrs to fix

            File action_req_certificate.php has 372 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /*
             * *****************************************************************************
             * Contributions to this work were made on behalf of the GÉANT project, a 
             * project that has received funding from the European Union’s Framework 
            Severity: Minor
            Found in web/admin/action_req_certificate.php - About 4 hrs to fix

              Function findLoginIdPByEmail has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function findLoginIdPByEmail($mail, $lang)
                  {
                      $loggerInstance = new common\Logging();
                      $listOfProviders = [];
                      $matchedProviders = [];
              Severity: Minor
              Found in core/User.php - About 4 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 ask has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
              Open

                  def ask(self, question: str, prompt: str = '', default: bool = None) -> int:
                      """
                      Prompt user for a Y/N reply, possibly supplying a default answer
                      """
                      if self.silent:
              Severity: Minor
              Found in devices/linux/Files/main.py - About 4 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

              File InputValidation.php has 370 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              /*
               * *****************************************************************************
               * Contributions to this work were made on behalf of the GÉANT project, a 
              Severity: Minor
              Found in web/lib/common/InputValidation.php - About 4 hrs to fix

                File CertificationAuthorityEduPkiServer.php has 366 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                /*
                 * ******************************************************************************
                 * Copyright 2011-2017 DANTE Ltd. and GÉANT on behalf of the GN3, GN3+, GN4-1 
                Severity: Minor
                Found in core/CertificationAuthorityEduPkiServer.php - About 4 hrs to fix

                  File OptionParser.php has 365 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  /*
                   * *****************************************************************************
                   * Contributions to this work were made on behalf of the GÉANT project, a 
                  Severity: Minor
                  Found in web/lib/admin/OptionParser.php - About 4 hrs to fix

                    Function exec has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function exec($querystring, $types = NULL, &...$arguments)
                        {
                            // log exact query to audit log, if it's not a SELECT
                            $isMoreThanSelect = FALSE;
                            if (preg_match("/^(SELECT\ |SET\ )/i", $querystring) == 0 && preg_match("/^DESC/i", $querystring) == 0) {
                    Severity: Minor
                    Found in core/DBConnection.php - About 4 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

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

                            try {
                                $db2 = DBConnection::handle($databaseName2);
                                if (\config\ConfAssistant::CONSORTIUM['name'] == "eduroam" && isset(\config\ConfAssistant::CONSORTIUM['deployment-voodoo']) && \config\ConfAssistant::CONSORTIUM['deployment-voodoo'] == "Operations Team") { // SW: APPROVED
                                    $res2 = $db2->exec('desc view_admin');
                                    if ($res2->num_rows == $this->viewAdminCount) {
                    Severity: Major
                    Found in core/SanityTests.php and 1 other location - About 4 hrs to fix
                    core/SanityTests.php on lines 884..899

                    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 176.

                    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

                                try {
                                    $db3 = DBConnection::handle($databaseName3);
                                    if (\config\ConfAssistant::CONSORTIUM['name'] == "eduroam" && isset(\config\ConfAssistant::CONSORTIUM['deployment-voodoo']) && \config\ConfAssistant::CONSORTIUM['deployment-voodoo'] == "Operations Team") { // SW: APPROVED
                                        $res3 = $db3->exec('desc view_admin');
                                        if ($res3->num_rows == $this->viewAdminCount) {
                    Severity: Major
                    Found in core/SanityTests.php and 1 other location - About 4 hrs to fix
                    core/SanityTests.php on lines 866..880

                    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 176.

                    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

                    File WindowsCommon.php has 357 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    /*
                     * *****************************************************************************
                     * Contributions to this work were made on behalf of the GÉANT project, a 
                    Severity: Minor
                    Found in devices/ms/WindowsCommon.php - About 4 hrs to fix

                      File OptionDisplay.php has 353 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      /*
                       * *****************************************************************************
                       * Contributions to this work were made on behalf of the GÉANT project, a 
                      Severity: Minor
                      Found in web/lib/admin/OptionDisplay.php - About 4 hrs to fix

                        Function postProcessValidAttributes has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function postProcessValidAttributes(array $options, array &$good, array &$bad) {
                                foreach ($options as $index => $iterateOption) {
                                    foreach ($iterateOption as $name => $optionPayload) {
                                        switch ($name) {
                                            case "eap:ca_url": // eap:ca_url becomes eap:ca_file by downloading the file
                        Severity: Minor
                        Found in web/lib/admin/OptionParser.php - About 4 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 downloadStatsCore has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function downloadStatsCore($detail = '')
                            {
                                if ($detail !== 'ORGANISATIONS' && $detail !== 'PROFILES' && $detail !== 'FEDERATION') {
                                    $detail = 'NONE';
                                }
                        Severity: Minor
                        Found in core/Federation.php - About 4 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 openroamingRedinessTest has 109 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function openroamingRedinessTest() {
                                // do OpenRoaming initial diagnostic checks
                                // numbers correspond to RFC7585Tests::OVERALL_LEVEL
                                $results = [];
                                $resultLevel = $this::OVERALL_OPENROAMING_LEVEL_GOOD; // assume all is well, degrade if we have concrete findings to suggest otherwise
                        Severity: Major
                        Found in core/AbstractProfile.php - About 4 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language