Showing 599 of 599 total issues

Function setRADIUSconfig has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function setRADIUSconfig($onlyone = 0, $notify = 0)
    {
        $remove = ($this->status == \core\AbstractDeployment::INACTIVE) ? 0 : 1;
        $toPost = ($onlyone ? array($onlyone => '') : array(1 => '', 2 => ''));
        $toPostTemplate = 'instid=' . $this->institution . '&deploymentid=' . $this->identifier . '&secret=' . $this->secret . '&country=' . $this->getAttributes("internal:country")[0]['value'] . '&';
Severity: Minor
Found in core/DeploymentManaged.php - About 2 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 opensslCAResult has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function opensslCAResult($host, $opensslbabble)
    {
        if (preg_match('/connect: Connection refused/', implode($opensslbabble))) {
            $this->TLS_CA_checks_result[$host]['status'] = RADIUSTests::RETVAL_CONNECTION_REFUSED;
            return RADIUSTests::RETVAL_INVALID;
Severity: Minor
Found in core/diag/RFC6614Tests.php - About 2 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 run_installer has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def run_installer() -> None:
    """
    This is the main installer part. It tests for NM availability
    gets user credentials and starts a proper installer.
    """
Severity: Minor
Found in devices/linux/Files/main.py - About 2 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 newIdP has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function newIdP($type, $ownerId, $level, $mail = NULL, $bestnameguess = NULL)
    {
        $this->databaseHandle->exec("INSERT INTO institution (country, type) VALUES('$this->tld', '$type')");
        $identifier = $this->databaseHandle->lastID();

Severity: Major
Found in core/Federation.php - About 2 hrs to fix

    Method consolidateUdpResult has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function consolidateUdpResult($host) {
            \core\common\Entity::intoThePotatoes();
            $ret = [];
            $serverCert = [];
            $udpResult = $this->UDP_reachability_result[$host];
    Severity: Major
    Found in core/diag/RADIUSTests.php - About 2 hrs to fix

      Method downloadStatsCore has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function downloadStatsCore($detail = '')
          {
              if ($detail !== 'ORGANISATIONS' && $detail !== 'PROFILES' && $detail !== 'FEDERATION') {
                  $detail = 'NONE';
              }
      Severity: Major
      Found in core/Federation.php - About 2 hrs to fix

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

            public function writeInstaller()
            {
                $dom = textdomain(NULL);
                textdomain("devices");
                // create certificate files and save their names in $caFiles array
        Severity: Major
        Found in devices/ms/DeviceVista7.php - About 2 hrs to fix

          Method initEduPKISoapSession has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function initEduPKISoapSession($type)
              {
                  // set context parameters common to both endpoints
                  $context_params = [
                      'http' => [
          Severity: Major
          Found in core/CertificationAuthorityEduPkiServer.php - About 2 hrs to fix

            Method determineMailsToSend has 51 lines of code (exceeds 25 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: Major
            Found in core/diag/Logopath.php - About 2 hrs to fix

              Method magic has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function magic()
                  {
                      $this->testId = \core\CAT::uuid();
                      $this->databaseHandle->exec("INSERT INTO diagnosticrun (test_id, realm, suspects, evidence) VALUES ('$this->testId', '$this->realm', NULL, NULL)");
                      // simple things first: do we know anything about the realm, either
              Severity: Major
              Found in core/diag/Telepath.php - About 2 hrs to fix

                Method checkLineparse has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function checkLineparse($inputarray, $desiredCheck) {
                        foreach ($inputarray as $lineid => $line) {
                            switch ($desiredCheck) {
                                case self::LINEPARSE_CHECK_REJECTIGNORE:
                                    if (preg_match("/Attribute 18 (Reply-Message)/", $line) && preg_match("/Reject instead of Ignore at eduroam.org/", $inputarray[$lineid + 1])) {
                Severity: Major
                Found in core/diag/RADIUSTests.php - About 2 hrs to fix

                  Method printStatic has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Method initEduPKISoapSession has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function initEduPKISoapSession($type)
                        {
                            // set context parameters common to both endpoints
                            $context_params = [
                                'http' => [
                    Severity: Major
                    Found in core/CertificationAuthorityEduPki.php - About 2 hrs to fix

                      Method checkUploadSanity has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              private function checkUploadSanity(string $optiontype, string $incomingBinary) {
                              switch ($optiontype) {
                                  case "general:logo_file":
                                  case "fed:logo_file":
                                  case "internal:logo_from_url":
                      Severity: Minor
                      Found in web/lib/admin/OptionParser.php - About 2 hrs to fix

                        Method writeWLANprofile has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function writeWLANprofile($wlanProfileName, $ssid, $auth, $encryption, $eapConfig, $profileNumber) {
                                $profileFileCont = '<?xml version="1.0"?>
                        <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
                        <name>' . $wlanProfileName . '</name>
                        <SSIDConfig>
                        Severity: Minor
                        Found in devices/ms/DeviceVista7.php - About 2 hrs to fix

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

                              public function __construct() {
                                  \core\common\Entity::intoThePotatoes();
                                  $this->templates[WELCOME_ABOARD_PAGEHEADING] = sprintf(_("Welcome aboard the %s user community!"), \config\ConfAssistant::CONSORTIUM['display_name']);
                                  $this->templates[WELCOME_ABOARD_DOWNLOAD] = _("Your download will start shortly. In case of problems with the automatic download please use this direct <a href=''>link</a>.");
                                  $this->templates[WELCOME_ABOARD_HEADING] = sprintf(_("Dear user from %s,"), "<span class='inst_name'></span>");
                          Severity: Minor
                          Found in web/lib/user/TextTemplates.php - About 1 hr to fix

                            Method eapBlock has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function eapBlock($eapType)
                                {
                                    $realm = $this->determineOuterIdString();
                                    $retval = "<key>EAPClientConfiguration</key>
                                              <dict>
                            Severity: Minor
                            Found in devices/apple_mobileconfig/MobileconfigSuperclass.php - About 1 hr to fix

                              Method postProcessValidAttributes has 48 lines of code (exceeds 25 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 1 hr to fix

                                Method triggerNewOCSPStatement has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function triggerNewOCSPStatement($serial): string
                                    {
                                        $cert = new SilverbulletCertificate($serial, \devices\Devices::SUPPORT_EMBEDDED_ECDSA);
                                        $certstatus = "";
                                        // get all relevant info from object properties
                                Severity: Minor
                                Found in core/CertificationAuthorityEmbeddedECDSA.php - About 1 hr to fix

                                  Method triggerNewOCSPStatement has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function triggerNewOCSPStatement($serial): string
                                      {
                                          $cert = new SilverbulletCertificate($serial, \devices\Devices::SUPPORT_EMBEDDED_RSA);
                                          $certstatus = "";
                                          // get all relevant info from object properties
                                  Severity: Minor
                                  Found in core/CertificationAuthorityEmbeddedRSA.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language