Showing 529 of 599 total issues

Method testDatabases has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function testDatabases()
    {
        $databaseName1 = 'INST';
        try {
            $db1 = DBConnection::handle($databaseName1);
Severity: Minor
Found in core/SanityTests.php - About 1 hr to fix

    Method setLang has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function setLang($hardSetLang = 0)
        {
            // $langConverted will contain candidates for the language setting in the order
            // of preference
            $loggerInstance = new \core\common\Logging();
    Severity: Minor
    Found in core/common/Language.php - About 1 hr to fix

      Method statusServerCheck has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function statusServerCheck()
          {
              // request authenticator and other variable content
              $reqAuthenticator = random_bytes(16);
              $packetIdentifier = random_bytes(1);
      Severity: Minor
      Found in core/diag/RFC5997Tests.php - About 1 hr to fix

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

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

              public function writeInstaller()
              {
                  $this->loggerInstance->debug(4, "Chromebook Installer start\n");
                  $caRefs = [];
                  // we don't do per-user encrypted containers
          Severity: Minor
          Found in devices/chromebook/DeviceChromebook.php - About 1 hr to fix

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

                public function writeInstaller()
                {
                    \core\common\Entity::intoThePotatoes();
                    $this->prepareInstallerLang();
                    $this->setupEapConfig();
            Severity: Minor
            Found in devices/ms/DeviceW8W10.php - About 1 hr to fix

              Method setGlobalDynamicResult has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function setGlobalDynamicResult()
                  {
                      if (isset($this->allReachabilityResults['capath'])) {
                          foreach ($this->allReachabilityResults['capath'] as $capath) {
                              $this->globalLevelDynamic = max($this->globalLevelDynamic, $capath->level);
              Severity: Minor
              Found in core/diag/RADIUSTestsUI.php - About 1 hr to fix

                Function __prepare_network_block has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def __prepare_network_block(ssid: str, user_data: Type[InstallerData]) -> str:
                        interface = """network={
                        ssid=\"""" + ssid + """\"
                        key_mgmt=WPA-EAP
                        pairwise=CCMP
                Severity: Minor
                Found in devices/linux/Files/main.py - About 1 hr to fix

                  Method tlsClientSideCheck has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function tlsClientSideCheck(string $host, string $ename, string $realm)
                      {
                          $res = RADIUSTests::RETVAL_OK;
                          if (!is_array(\config\Diagnostics::RADIUSTESTS['TLS-clientcerts']) || count(\config\Diagnostics::RADIUSTESTS['TLS-clientcerts']) == 0) {
                              return RADIUSTests::RETVAL_SKIPPED;
                  Severity: Minor
                  Found in core/diag/RFC6614Tests.php - About 1 hr to fix

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

                        public function writeInstaller()
                        {
                            \core\common\Entity::intoThePotatoes();
                    
                            $this->loggerInstance->debug(4, "mobileconfig Module Installer start\n");
                    Severity: Minor
                    Found in devices/apple_mobileconfig/MobileconfigSuperclass.php - About 1 hr to fix

                      Method listIdentityProviders has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function listIdentityProviders($activeOnly = 0)
                          {
                              // maybe we did this exercise before?
                              if ($activeOnly != 0 && count($this->idpListActive) > 0) {
                                  return $this->idpListActive;
                      Severity: Minor
                      Found in core/Federation.php - About 1 hr to fix

                        Method getLogo has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function getLogo($identifier, $type, $widthIn, $heightIn)
                            {
                                $expiresString = '';
                                $attributeName = [
                                    'federation' => "fed:logo_file",
                        Severity: Minor
                        Found in core/UserAPI.php - About 1 hr to fix

                          Method listIdentityProvidersWithProfiles has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function listIdentityProvidersWithProfiles() {
                                  $handle = DBConnection::handle("INST");
                                  $handle->exec("SET SESSION group_concat_max_len=10000");
                                  $idpQuery = IdPlist::setAllIdentyProvidersQuery(1);
                                  $allIDPs = $handle->exec($idpQuery);
                          Severity: Minor
                          Found in core/IdPlist.php - About 1 hr to fix

                            Method CATInternalTests has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function CATInternalTests()
                                {
                                    // we are expecting to get a REJECT from all runs, because that means the packet got through to the IdP.
                                    // (the ETLR sometimes does a "Reject instead of Ignore" but that is filtered out and changed into a timeout
                                    // by the test suite automatically, so it does not disturb the measurement)
                            Severity: Minor
                            Found in core/diag/Telepath.php - About 1 hr to fix

                              Function existingIdPInt has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function existingIdPInt($input, $owner = NULL, $claimedFedBinding = NULL)
                                  {
                                      $clean = $this->integer($input);
                                      if ($clean === FALSE) {
                                          throw new Exception($this->inputValidationError("Value for IdP is not an integer!"));
                              Severity: Minor
                              Found in web/lib/common/InputValidation.php - About 1 hr 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 testGeoip has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function testGeoip()
                                  {
                                      $host_4 = '145.0.2.50';
                                      $host_6 = '2001:610:188:444::50';
                                      switch (\config\Master::GEOIP['version']) {
                              Severity: Minor
                              Found in core/SanityTests.php - About 1 hr 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 getIdentityProvidersCertStatus has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function getIdentityProvidersCertStatus() {
                                      $query = "SELECT distinct profile.profile_id  FROM profile JOIN profile_option ON profile.profile_id = profile_option.profile_id WHERE option_name='profile:production' AND profile.sufficient_config = 1";
                                      $activeProfiles = [];
                                      $result = $this->databaseHandle->exec($query);
                                      $rows = $result->fetch_all();
                              Severity: Minor
                              Found in core/Federation.php - About 1 hr 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 getUserAuthRecords has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function getUserAuthRecords($userId, $testActivity = false) {
                                      // find out all certificate CNs belonging to the user, including expired and revoked ones
                                      $userData = $this->userStatus($userId);
                                      $certNames = [];
                                      foreach ($userData as $oneSlice) {
                              Severity: Minor
                              Found in core/ProfileSilverbullet.php - About 1 hr 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 findGoodServerLocation has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function findGoodServerLocation($adminLocation, $federation, $blacklistedServers)
                                  {
                                      // find a server near him (list of all servers with capacity, ordered by distance)
                                      // first, if there is a pool of servers specifically for this federation, prefer it
                                      // only check the consortium pool group we want to attach to
                              Severity: Minor
                              Found in core/DeploymentManaged.php - About 1 hr 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 getAttributes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function getAttributes(string $optionName = NULL, string $omittedOptionName = NULL)
                                  {
                                      if ($optionName !== NULL) {
                                          if ($optionName === $omittedOptionName) {
                                              throw new Exception("The attibute to be shown has the same name as that to be omitted");
                              Severity: Minor
                              Found in core/EntityWithDBProperties.php - About 1 hr 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

                              Severity
                              Category
                              Status
                              Source
                              Language