Showing 599 of 599 total issues

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

    public function createTokens($isByFedadmin, $for, $instIdentifier, $externalId = 0, $country = 0, $partType = 0)
    {
        $level = ($isByFedadmin ? "FED" : "INST");
        $tokenList = [];
        foreach ($for as $oneDest) {
Severity: Minor
Found in core/UserManagement.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

Method processCertificate has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function processCertificate($cadata)
    {
        $pemBegin = strpos($cadata, "-----BEGIN CERTIFICATE-----");
        if ($pemBegin !== FALSE) {
            $pemEnd = strpos($cadata, "-----END CERTIFICATE-----") + 25;
Severity: Minor
Found in core/common/X509.php - About 1 hr to fix

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

        public function __construct($visibility = 'all', $selectedLang = '') {
            $langsArray = [];
            foreach (\config\Master::LANGUAGES as $lang => $value) {
                if ($lang == $selectedLang) {
                    $langsArray[] = ['text'=>$value['display'], 'link'=>'javascript:changeLang("' . $lang . '")', 'class'=>'selected-lang'];
    Severity: Minor
    Found in web/skins/modern/Menu.php - About 1 hr to fix

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

          public function __construct($profileId, $idpObject = NULL)
          {
              parent::__construct($profileId, $idpObject);
      
              $this->entityOptionTable = "profile_option";
      Severity: Minor
      Found in core/ProfileRADIUS.php - About 1 hr to fix

        Method listAllIdentityProviders has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function listAllIdentityProviders($activeOnly = 0, $country = "")
            {
                common\Entity::intoThePotatoes();
                $handle = DBConnection::handle("INST");
                $handle->exec("SET SESSION group_concat_max_len=10000");
        Severity: Minor
        Found in core/IdPlist.php - About 1 hr to fix

          Method pickupFinalCert has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function pickupFinalCert($soapReqnum, $wait)
              {
                  try {
                      $soap = $this->initEduPKISoapSession("RA");
                      $counter = 0;
          Severity: Minor
          Found in core/CertificationAuthorityEduPkiServer.php - About 1 hr to fix

            Method createIdPFromToken has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function createIdPFromToken(string $token, string $owner)
                {
                    new CAT(); // be sure that Entity's static members are initialised
                    common\Entity::intoThePotatoes();
                    // the token either has cat_institution_id set -> new admin for existing inst
            Severity: Minor
            Found in core/UserManagement.php - About 1 hr to fix

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

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

                array_push($FAQ, [
                    'title' => _("Windows 'SmartScreen' or 'Internet Explorer' tell me that the file is not commonly downloaded and possibly harmful. Should I be concerned?"),
                    'text' => _("Contrary to what the name suggests, 'SmartScreen' isn't actually very smart. The warning merely means that the file has not yet been downloaded by enough users to make Microsoft consider it popular (which would strangely enough make it be considered 'safe'). This message alone is not a security problem.") . " " . (isset(\config\ConfAssistant::CONSORTIUM['signer_name']) && \config\ConfAssistant::CONSORTIUM['signer_name'] != "" ? sprintf(_("So long as the file is carrying a valid signature from %s, the download is safe."), \config\ConfAssistant::CONSORTIUM['signer_name']) . " " : "") . sprintf(_("Please see also Microsoft's FAQ regarding SmartScreen at %s."), "<a href='http://windows.microsoft.com/en-US/windows7/SmartScreen-Filter-frequently-asked-questions-IE9?SignedIn=1'>Microsoft FAQ</a>")
                ]);
                Severity: Major
                Found in web/user/faq.php and 1 other location - About 1 hr to fix
                web/user/faq.inc.php on lines 50..53

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

                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

                    [
                        'title' => _("Windows 'SmartScreen' or 'Internet Explorer' tell me that the file is not commonly downloaded and possibly harmful. Should I be concerned?"),
                        'text' => _("Contrary to what the name suggests, 'SmartScreen' isn't actually very smart. The warning merely means that the file has not yet been downloaded by enough users to make Microsoft consider it popular (which would strangely enough make it be considered 'safe'). This message alone is not a security problem.") . " " . (isset(\config\ConfAssistant::CONSORTIUM['signer_name']) && \config\ConfAssistant::CONSORTIUM['signer_name'] != "" ? sprintf(_("So long as the file is carrying a valid signature from %s, the download is safe."), \config\ConfAssistant::CONSORTIUM['signer_name']) . " " : "") . sprintf(_("Please see also Microsoft's FAQ regarding SmartScreen at %s."), "<a href='http://windows.microsoft.com/en-US/windows7/SmartScreen-Filter-frequently-asked-questions-IE9?SignedIn=1'>Microsoft FAQ</a>")
                    ],
                Severity: Major
                Found in web/user/faq.inc.php and 1 other location - About 1 hr to fix
                web/user/faq.php on lines 56..59

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

                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

                Function prefillText has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function prefillText(int $rowid, string $optionName, string $optionValue, $optionLang)
                    {
                        \core\common\Entity::intoThePotatoes();
                        $retval = "";
                        $optioninfo = \core\Options::instance();
                Severity: Minor
                Found in web/lib/admin/OptionDisplay.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 productheader has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function productheader($area) {
                        \core\common\Entity::intoThePotatoes();
                        $language = $this->languageInstance->getLang();
                        // this <div is closing in footer, keep it in PHP for Netbeans syntax
                        // highlighting to work
                Severity: Minor
                Found in web/lib/admin/PageDecoration.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 listIdentityProviders has a Cognitive Complexity of 13 (exceeds 5 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

                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 listExternalEntities has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function listExternalEntities($unmappedOnly, $type = NULL)
                    {
                        $allExternals = [];
                        $usedarray = [];
                        $returnarray = [];
                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 testPhpModules has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function testPhpModules()
                    {
                        if (function_exists('idn_to_ascii')) {
                            $this->storeTestResult(\core\common\Entity::L_OK, "PHP can handle internationalisation.");
                        } else {
                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 listAllIdentityProviders has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function listAllIdentityProviders($activeOnly = 0, $country = "")
                    {
                        common\Entity::intoThePotatoes();
                        $handle = DBConnection::handle("INST");
                        $handle->exec("SET SESSION group_concat_max_len=10000");
                Severity: Minor
                Found in core/CAT.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 writeConfigVars has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function writeConfigVars($file) {
                        $eapMethod = \core\common\EAP::eapDisplayName($this->selectedEap);
                        $contacts = $this->mkSupportContacts();
                        $tou = $this->mkUserConsent();
                        $outerId = $this->determineOuterIdString();
                Severity: Minor
                Found in devices/linux/DeviceLinux.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 magic has a Cognitive Complexity of 13 (exceeds 5 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: Minor
                Found in core/diag/Telepath.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 pickupFinalCert has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function pickupFinalCert($soapReqnum, $wait)
                    {
                        try {
                            $soap = $this->initEduPKISoapSession("RA");
                            $counter = 0;
                Severity: Minor
                Found in core/CertificationAuthorityEduPkiServer.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 __construct has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function __construct($realm, $outerUsernameForChecks, $supportedEapTypes = [], $expectedServerNames = [], $expectedCABundle = []) {
                        parent::__construct();
                
                        $this->realm = $realm;
                        $this->outerUsernameForChecks = $outerUsernameForChecks;
                Severity: Minor
                Found in core/diag/RADIUSTests.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