Showing 503 of 577 total issues

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

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

                      File CertificationAuthorityEduPki.php has 303 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/CertificationAuthorityEduPki.php - About 3 hrs to fix

                        Function deleteObsoleteTempDirs has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function deleteObsoleteTempDirs() {
                                $downloadsDirs = [
                                    'site_installers' => dirname(dirname(dirname(dirname(__FILE__)))) . "/var/installer_cache",
                                    'silverbullet' => dirname(dirname(dirname(dirname(__FILE__)))) . "/var/silverbullet"
                                ];
                        Severity: Minor
                        Found in web/lib/admin/Maintenance.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 mailAddressValidSecure has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function mailAddressValidSecure($address)
                            {
                                $loggerInstance = new \core\common\Logging();
                                if (!filter_var($address, FILTER_VALIDATE_EMAIL)) {
                                    $loggerInstance->debug(4, "OutsideComm::mailAddressValidSecure: invalid mail address.");
                        Severity: Minor
                        Found in core/common/OutsideComm.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 adminInvitationMail has a Cognitive Complexity of 23 (exceeds 5 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: Minor
                        Found in core/common/OutsideComm.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 extractIncomingCertsfromEAP has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function extractIncomingCertsfromEAP(&$testresults, $tmpDir) {
                        
                                /*
                                 *  EAP's house rules:
                                 * 1) it is unnecessary to include the root CA itself (adding it has
                        Severity: Minor
                        Found in core/diag/RADIUSTests.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 relevantNAPTRhostnameResolution has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function relevantNAPTRhostnameResolution()
                            {
                        // make sure the previous tests have been run before we go on
                        // preceding tests will cascade automatically if needed
                                if ($this->NAPTR_SRV_executed == RFC7585Tests::RETVAL_NOTRUNYET) {
                        Severity: Minor
                        Found in core/diag/RFC7585Tests.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

                        Method marshalObject has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function marshalObject($domElement, $node, $name, $object, $namespace = NULL, $root = false)
                            {
                                if (is_null($object)) {
                                    return;
                                }
                        Severity: Major
                        Found in core/DeviceXMLmain.php - About 3 hrs to fix

                          File OutsideComm.php has 301 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/common/OutsideComm.php - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language