Showing 529 of 599 total issues

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

    File OutsideComm.php has 305 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

      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
                   *    detrimental effects on performance)
          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

          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

            InputValidation has 27 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class InputValidation extends \core\common\Entity
            {
            
                /**
                 * returns a simple HTML <p> element with basic explanations about what was
            Severity: Minor
            Found in web/lib/common/InputValidation.php - About 3 hrs to fix

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

                  public static function enumerateOptionsToDisplay($class, $fed, $device='')
                  {
                      $optioninfo = \core\Options::instance();
                      $loggerInstance = new \core\common\Logging();
                      $list = $optioninfo->availableOptions($class);
              Severity: Minor
              Found in web/lib/admin/OptionDisplay.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 testDefaults has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function testDefaults()
                  {
                      $defaultvalues = "";
                      $missingvalues = "";
                      // all the checks for equality with a shipped default value
              Severity: Minor
              Found in core/SanityTests.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 propertyCheckServercert has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function propertyCheckServercert(&$servercert) {
              // we share the same checks as for CAs when it comes to signature algorithm and basicconstraints
              // so call that function and memorise the outcome
                      $returnarray = $this->propertyCheckIntermediate($servercert, TRUE);
                      $sANdns = [];
              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

              Method writeInstaller has 76 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function writeInstaller()
                  {
                      \core\common\Entity::intoThePotatoes();
                      $rootname = 'EAPIdentityProviderList';
                      $dom = new \DOMDocument('1.0', 'utf-8');
              Severity: Major
              Found in devices/eap_config/DeviceXML.php - About 3 hrs to fix

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

                    public function __construct($profileId, $idpObject = NULL) {
                        parent::__construct($profileId, $idpObject);
                
                        $this->entityOptionTable = "profile_option";
                        $this->entityIdColumn = "profile_id";
                Severity: Major
                Found in core/ProfileSilverbullet.php - About 2 hrs to fix

                  Method genericAPIStatus has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function genericAPIStatus($type, $param1 = NULL, $param2 = NULL)
                      {
                          $endpoints = [
                              'tlr_test' => "https://monitor.eduroam.org/mapi/index.php?type=tlr_test&tlr=$param1",
                              'federation_via_tlr' => "https://monitor.eduroam.org/mapi/index.php?type=federation_via_tlr&federation=$param1",
                  Severity: Major
                  Found in core/diag/Telepath.php - About 2 hrs to fix

                    Method collectCAPath has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function collectCAPath()
                        {
                            $capathtest = [];
                            $capathtest[] = '<p><strong>'._("Checking server handshake...")."</strong><p>";
                            $allfailed = TRUE;
                    Severity: Major
                    Found in core/diag/RADIUSTestsUI.php - About 2 hrs to fix

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

                          public function __construct() {
                              parent::__construct();
                              \core\common\Entity::intoThePotatoes();
                              $this->userEmail = FALSE;
                              $this->additionalScreenshot = FALSE;
                      Severity: Major
                      Found in core/diag/Logopath.php - About 2 hrs to fix

                        Method autodetectCAWithProbe has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function autodetectCAWithProbe($outerId) {
                                // for EAP-TLS to be a viable option, we need to pass a random client cert to make eapol_test happy
                                // the following PEM data is one of the SENSE EAPLab client certs (not secret at all)
                                $clientcert = file_get_contents(dirname(__FILE__) . "/clientcert.p12");
                                if ($clientcert === FALSE) {
                        Severity: Major
                        Found in core/diag/RADIUSTests.php - About 2 hrs to fix

                          File DeviceW8W10.php has 287 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/DeviceW8W10.php - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language