Showing 599 of 599 total issues

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

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

                  private function glueServerNames() {
                      $serverList = $this->attributes['eap:server_name'];        
                      if (!$serverList) {
                          return '';
                      }
              Severity: Major
              Found in devices/linux/DeviceLinux.php and 1 other location - About 2 hrs to fix
              devices/linux/DeviceLinuxSh.php on lines 245..258

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

              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

                  private function glueServerNames() {
                      $serverList = $this->attributes['eap:server_name'];
                      if (!$serverList) {
                          return '';
                      }
              Severity: Major
              Found in devices/linux/DeviceLinuxSh.php and 1 other location - About 2 hrs to fix
              devices/linux/DeviceLinux.php on lines 242..255

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

              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 IdPlist.php has 283 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/IdPlist.php - About 2 hrs to fix

                Method selectElement has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function selectElement($rowid, $list)
                    {
                        $jsmagic = "onchange='
                                               if (/#ML#/.test(document.getElementById(\"option-S" . $rowid . "-select\").value)) {
                                                   document.getElementById(\"S$rowid-input-langselect\").style.display = \"block\";
                Severity: Major
                Found in web/lib/admin/OptionDisplay.php - About 2 hrs to fix

                  Method prefillText has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function prefillText(int $rowid, string $optionName, string $optionValue, $optionLang)
                      {
                          \core\common\Entity::intoThePotatoes();
                          $retval = "";
                          $optioninfo = \core\Options::instance();
                  Severity: Major
                  Found in web/lib/admin/OptionDisplay.php - About 2 hrs to fix

                    Method issueCertificate has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function issueCertificate($token, $importPassword, $certtype)
                        {
                            $loggerInstance = new common\Logging();
                            $databaseHandle = DBConnection::handle("INST");
                            $loggerInstance->debug(5, "generateCertificate() - starting.\n");
                    Severity: Major
                    Found in core/SilverbulletCertificate.php - About 2 hrs to fix

                      Function testDatabases has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function testDatabases()
                          {
                              $databaseName1 = 'INST';
                              try {
                                  $db1 = DBConnection::handle($databaseName1);
                      Severity: Minor
                      Found in core/SanityTests.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 testDeviceCache has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function testDeviceCache()
                          {
                              if ((!empty(\devices\Devices::$Options['no_cache'])) && \devices\Devices::$Options['no_cache']) {
                                  $global_no_cache = 1;
                              } else {
                      Severity: Minor
                      Found in core/SanityTests.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 __construct has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function __construct($token)
                          {
                              parent::__construct();
                              $this->globalInfo = [
                                  \core\common\Entity::L_OK => _("All tests passed."),
                      Severity: Minor
                      Found in core/diag/RADIUSTestsUI.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 checkLineparse has a Cognitive Complexity of 20 (exceeds 5 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: Minor
                      Found in core/diag/RADIUSTests.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 consolidateUdpResult has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function consolidateUdpResult($host) {
                              \core\common\Entity::intoThePotatoes();
                              $ret = [];
                              $serverCert = [];
                              $udpResult = $this->UDP_reachability_result[$host];
                      Severity: Minor
                      Found in core/diag/RADIUSTests.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 __select_p12_file has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __select_p12_file(self) -> str:
                              """
                              prompt user for the PFX file selection
                              this method is not being called in the silent mode
                              therefore there is no code for this case
                      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 findLoginIdPByEmail has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function findLoginIdPByEmail($mail, $lang)
                          {
                              $loggerInstance = new common\Logging();
                              $listOfProviders = [];
                              $matchedProviders = [];
                      Severity: Major
                      Found in core/User.php - About 2 hrs to fix

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

                            public function __construct($idpObject, $deploymentIdRaw, $consortium = 'eduroam')
                            {
                                parent::__construct($idpObject, $deploymentIdRaw); // we now have access to our INST database handle and logging
                                $this->entityOptionTable = "deployment_option";
                                $this->entityIdColumn = "deployment_id";
                        Severity: Major
                        Found in core/DeploymentManaged.php - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language