Showing 577 of 577 total issues

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

                            if (isset($_GET['res']) && is_array($_GET['res'])) {
                                $res = array_count_values($_GET['res']);
                                if ($res['FAILURE'] > 0) {
                                    echo '<br>';
                                    if ($res['FAILURE'] == 2) {
Severity: Major
Found in web/admin/overview_org.php and 1 other location - About 4 hrs to fix
web/admin/overview_sp.php on lines 268..282

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

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 OptionDisplay.php has 336 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

    File Federation.php has 334 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/Federation.php - About 4 hrs to fix

      Function determineMailsToSend has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          private function determineMailsToSend() {
              $this->mailQueue = [];
      // check for IDP_EXISTS_BUT_NO_DATABASE
              if (!in_array(AbstractTest::INFRA_NONEXISTENTREALM, $this->possibleFailureReasons) && $this->additionalFindings[AbstractTest::INFRA_NONEXISTENTREALM]['DATABASE_STATUS']['ID2'] < 0) {
                  $this->mailQueue[] = Logopath::IDP_EXISTS_BUT_NO_DATABASE;
      Severity: Minor
      Found in core/diag/Logopath.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

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

                      if (count(\config\ConfAssistant::CONSORTIUM['ssid']) > 0) {
                          $ssidlist = "";
                          foreach (\config\ConfAssistant::CONSORTIUM['ssid'] as $ssid) {
                              $ssidlist .= ", '<strong>" . $ssid . "</strong>'";
                          }
      Severity: Major
      Found in web/admin/edit_participant.php and 1 other location - About 3 hrs to fix
      web/admin/edit_participant.php on lines 158..169

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

      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

                      if (count(\config\ConfAssistant::CONSORTIUM['interworking-consortium-oi']) > 0) {
                          $consortiumlist = "";
                          foreach (\config\ConfAssistant::CONSORTIUM['interworking-consortium-oi'] as $oi) {
                              $consortiumlist .= ", '<strong>" . $oi . "</strong>'";
                          }
      Severity: Major
      Found in web/admin/edit_participant.php and 1 other location - About 3 hrs to fix
      web/admin/edit_participant.php on lines 142..152

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

      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

      Function infoblock has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          public function infoblock(array $optionlist, string $class, string $level) {
              \core\common\Entity::intoThePotatoes();
              $locationMarkers = [];
              $retval = "";
              $optioninfo = \core\Options::instance();
      Severity: Minor
      Found in web/lib/admin/UIElements.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

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

          foreach ($userAuthData as $oneRecord) {
              echo "<tr class='".($oneRecord['result'] == "OK" ? "auth-success" : "auth-fail" )."'>"
                      . "<td>".$oneRecord['activity_time']."</td>"
                      . "<td>".$oneRecord['realm']."</td>"
                      . "<td>".$oneRecord['mac']."</td>"
      Severity: Major
      Found in web/admin/overview_org.php and 1 other location - About 3 hrs to fix
      web/admin/inc/deploymentStats.inc.php on lines 53..63

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

      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

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

          foreach ($userAuthData as $oneRecord) {
              echo "<tr class='".($oneRecord['result'] == "OK" ? "auth-success" : "auth-fail" )."'>"
                      . "<td>".$oneRecord['activity_time']."</td>"
                      // $oneRecord['CN'] is a simple string, not an array, so disable Scrutinizer type check here
                      . "<td>".$oneRecord['realm']."</td>"
      Severity: Major
      Found in web/admin/inc/deploymentStats.inc.php and 1 other location - About 3 hrs to fix
      web/admin/overview_org.php on lines 461..470

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

      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

      Method printOverview has 90 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function printOverview()
          {
              $out = [];
              $out[] = "<fieldset class='option_container'>
              <legend>
      Severity: Major
      Found in core/diag/RADIUSTestsUI.php - About 3 hrs to fix

        File InputValidation.php has 316 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 3 hrs to fix

          Function __process_p12 has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              def __process_p12(self) -> bool:
                  debug('process_p12')
                  pfx_file = get_config_path() + '/cat_installer/user.p12'
                  if CRYPTO_AVAILABLE:
                      debug("using crypto")
          Severity: Minor
          Found in devices/linux/Files/main.py - 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

          Method adminInvitationMail has 89 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function adminInvitationMail($targets, $introtext, $newtoken, $idpPrettyName, $federation, $type)
              {
                  if (!in_array($introtext, OutsideComm::INVITE_CONTEXTS)) {
                      throw new \Exception("Unknown invite mode!");
                  }
          Severity: Major
          Found in core/common/OutsideComm.php - About 3 hrs to fix

            Method listDevices has 88 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function listDevices()
                {
                    $returnarray = [];
                    $redirect = $this->getAttributes("device-specific:redirect"); // this might return per-device ones or the general one
                    // if it was a general one, we are done. Find out if there is one such
            Severity: Major
            Found in core/AbstractProfile.php - About 3 hrs to fix

              File Telepath.php has 311 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/diag/Telepath.php - About 3 hrs to fix

                Method collectClients has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function collectClients()
                    {
                        $clientstest = [];
                        foreach ($this->allReachabilityResults['clients'] as $clients) {
                            $hostindex = $clients->hostindex; 
                Severity: Major
                Found in core/diag/RADIUSTestsUI.php - About 3 hrs to fix

                  Method sanitiseInputs has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function sanitiseInputs(array $listOfEntries) {
                          $retval = [];
                          $bad = [];
                          $multilangAttrsWithC = [];
                          foreach ($listOfEntries as $objId => $objValueRaw) {
                  Severity: Major
                  Found in web/lib/admin/OptionParser.php - About 3 hrs to fix

                    SanityTests has 28 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class SanityTests extends CAT
                    {
                        /* in this section set current CAT requirements */
                    
                        /**
                    Severity: Minor
                    Found in core/SanityTests.php - About 3 hrs to fix

                      RADIUSTests has 28 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class RADIUSTests extends AbstractTest {
                      
                          /**
                           * Was the reachability check executed already?
                           * 
                      Severity: Minor
                      Found in core/diag/RADIUSTests.php - About 3 hrs to fix

                        Method networkBlock has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function networkBlock($blocktype, $toBeConfigured, $prettyName)
                            {
                                \core\common\Entity::intoThePotatoes();
                                $eapType = $this->selectedEap;
                                switch ($blocktype) {
                        Severity: Major
                        Found in devices/apple_mobileconfig/MobileconfigSuperclass.php - About 3 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language