Showing 599 of 599 total issues

Function listAllIdentityProviders has a Cognitive Complexity of 18 (exceeds 5 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 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 weNeedToTalk has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function weNeedToTalk() {
        $this->determineMailsToSend();
        foreach ($this->mailQueue as $oneMail) {
            $theMail = $this->mailStack[$oneMail];
            // if user interaction would have been good, but the user didn't 
Severity: Minor
Found in core/diag/Logopath.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 autodetectCAWithProbe has a Cognitive Complexity of 18 (exceeds 5 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: 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

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

    public function __construct($token)
    {
        parent::__construct();
        $this->globalInfo = [
            \core\common\Entity::L_OK => _("All tests passed."),
Severity: Major
Found in core/diag/RADIUSTestsUI.php - About 2 hrs to fix

    Method previewCAinHTML has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function previewCAinHTML($cAReference) {
            \core\common\Entity::intoThePotatoes();
            $validator = new \web\lib\common\InputValidation();
            $ref = $validator->databaseReference($cAReference);
            $caExpiryTrashhold = \config\ConfAssistant::CERT_WARNINGS['expiry_warning'];
    Severity: Major
    Found in web/lib/admin/UIElements.php - About 2 hrs to fix

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

          public function __construct($invitationId)
          {
              parent::__construct();
              $this->invitationTokenString = $invitationId;
              $handle = DBConnection::handle("INST");
      Severity: Major
      Found in core/SilverbulletInvitation.php - About 2 hrs to fix

        Method exec has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function exec($querystring, $types = NULL, &...$arguments)
            {
                // log exact query to audit log, if it's not a SELECT
                $isMoreThanSelect = FALSE;
                if (preg_match("/^(SELECT\ |SET\ )/i", $querystring) == 0 && preg_match("/^DESC/i", $querystring) == 0) {
        Severity: Major
        Found in core/DBConnection.php - About 2 hrs to fix

          Method writeConfigVars has 59 lines of code (exceeds 25 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: Major
          Found in devices/linux/DeviceLinuxSh.php - About 2 hrs to fix

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

              DeviceXML has 22 functions (exceeds 20 allowed). Consider refactoring.
              Open

              abstract class DeviceXML extends \core\DeviceConfig
              {
                  
                  /**
                   *  @var array $AuthMethodElements is used to limit
              Severity: Minor
              Found in devices/eap_config/DeviceXML.php - About 2 hrs to fix

                UIElements has 22 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class UIElements extends \core\common\Entity {
                
                    /**
                     * the custom displayable variant of the term 'federation'
                     * 
                Severity: Minor
                Found in web/lib/admin/UIElements.php - About 2 hrs to fix

                  UserAPI has 22 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class UserAPI extends CAT
                  {
                  
                      /**
                       * nothing special to be done here.
                  Severity: Minor
                  Found in core/UserAPI.php - About 2 hrs to fix

                    Method productheader has 58 lines of code (exceeds 25 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: Major
                    Found in web/lib/admin/PageDecoration.php - About 2 hrs to fix

                      File RFC6614Tests.php has 263 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/diag/RFC6614Tests.php - About 2 hrs to fix

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

                                    Logopath::IDP_SUSPECTED_PROBLEM_INTERACTIVE_EVIDENCED => [
                                        "to" => [Logopath::TARGET_IDP],
                                        "cc" => [],
                                        "bcc" => [],
                                        "reply-to" => [Logopath::TARGET_ENDUSER],
                        Severity: Major
                        Found in core/diag/Logopath.php and 1 other location - About 2 hrs to fix
                        core/diag/Logopath.php on lines 146..158

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

                        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

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

                                    Logopath::IDP_SUSPECTED_PROBLEM_INTERACTIVE_FORCED => [
                                        "to" => [Logopath::TARGET_IDP],
                                        "cc" => [],
                                        "bcc" => [],
                                        "reply-to" => [Logopath::TARGET_ENDUSER],
                        Severity: Major
                        Found in core/diag/Logopath.php and 1 other location - About 2 hrs to fix
                        core/diag/Logopath.php on lines 159..171

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

                        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 accountstatus.php has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        /*
                         * Contributions to this work were made on behalf of the GÉANT project, a 
                         * project that has received funding from the European Union’s Horizon 2020 
                         * research and innovation programme under Grant Agreement No. 731122 (GN4-2).
                        Severity: Minor
                        Found in web/skins/modern/accountstatus/accountstatus.php - About 2 hrs to fix

                          Function writeInstaller has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function writeInstaller()
                              {
                                  $dom = textdomain(NULL);
                                  textdomain("devices");
                                  // create certificate files and save their names in $caFiles array
                          Severity: Minor
                          Found in devices/ms/DeviceVista7.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 listIdentityProvidersWithProfiles has a Cognitive Complexity of 17 (exceeds 5 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 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 packetCountEvaluation has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function packetCountEvaluation(&$testresults, $packetcount) {
                                  $reqs = $packetcount[1] ?? 0;
                                  $accepts = $packetcount[2] ?? 0;
                                  $rejects = $packetcount[3] ?? 0;
                                  $challenges = $packetcount[11] ?? 0;
                          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

                          Severity
                          Category
                          Status
                          Source
                          Language