Showing 599 of 599 total issues

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

    public static function significantChanges($old, $new)
    {
        $retval = [];
        // check if a CA was added
        $x509 = new common\X509();
Severity: Minor
Found in core/AbstractProfile.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 signRequest has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function signRequest($csr, $expiryDays): array
    {
        if ($csr["CSR_STRING"] === NULL) {
            throw new Exception("This CA needs the CSR in a string (PEM)!");
        }
Severity: Minor
Found in core/CertificationAuthorityEduPki.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 __get_username_password has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def __get_username_password(self) -> None:
        """
        read user password and set the password property
        do nothing if silent mode is set
        """
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 listAllIdentityProviders has 56 lines of code (exceeds 25 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: Major
Found in core/CAT.php - About 2 hrs to fix

    File MapGoogle.php has 259 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 Framework 
    Severity: Minor
    Found in web/lib/admin/MapGoogle.php - About 2 hrs to fix

      Method scrub has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function scrub($inputJson, $fedObject) {        
              $optionInstance = \core\Options::instance();
              $parameters = [];
              $allPossibleAttribs = array_merge(API::ACTIONS[$inputJson['ACTION']]['REQ'], API::ACTIONS[$inputJson['ACTION']]['OPT'],  API::ACTIONS[$inputJson['ACTION']]['FLAG']);
              // some actions don't need parameters. Don't get excited when there aren't any.
      Severity: Major
      Found in web/lib/admin/API.php - About 2 hrs to fix

        Method writeConfigVars has 55 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/DeviceLinux.php - About 2 hrs to fix

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

                  } else { // one of the RADIUS DBs
                      $this->connection = new \mysqli(\config\ConfAssistant::DB[$databaseCapitalised]['host'], \config\ConfAssistant::DB[$databaseCapitalised]['user'], \config\ConfAssistant::DB[$databaseCapitalised]['pass'], \config\ConfAssistant::DB[$databaseCapitalised]['db']);
                      if ($this->connection->connect_error) {
                          throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number " . $this->connection->connect_errno . ").");
                      }
          Severity: Major
          Found in core/DBConnection.php and 1 other location - About 2 hrs to fix
          core/DBConnection.php on lines 280..292

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

          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

                  if (isset(\config\Master::DB[$databaseCapitalised])) {
                      $this->connection = new \mysqli(\config\Master::DB[$databaseCapitalised]['host'], \config\Master::DB[$databaseCapitalised]['user'], \config\Master::DB[$databaseCapitalised]['pass'], \config\Master::DB[$databaseCapitalised]['db']);
                      if ($this->connection->connect_error) {
                          throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number " . $this->connection->connect_errno . ").");
                      }
          Severity: Major
          Found in core/DBConnection.php and 1 other location - About 2 hrs to fix
          core/DBConnection.php on lines 286..292

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

          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

          Method furtherStringChecks has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function furtherStringChecks($attribute, $previsionalContent, &$bad) {
                  $content = FALSE;
                  switch ($attribute) {
                      case "media:consortium_OI":
                          $content = $this->validator->consortiumOI($previsionalContent);
          Severity: Major
          Found in web/lib/admin/OptionParser.php - About 2 hrs to fix

            Method udpLogin has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function udpLogin($probeindex, $eaptype, $innerUser, $password, $opnameCheck = TRUE, $frag = TRUE, $clientcertdata = NULL) {
                    $preliminaries = $this->udpLoginPreliminaries($probeindex, $eaptype, $clientcertdata);
                    if ($preliminaries !== TRUE) {
                        return $preliminaries;
                    }
            Severity: Major
            Found in core/diag/RADIUSTests.php - About 2 hrs to fix

              Method relevantNAPTRhostnameResolution has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function relevantNAPTRhostnameResolution()
                  {
              // make sure the previous tests have been run before we go on
              // preceding tests will cascade automatically if needed
                      if ($this->NAPTR_SRV_executed == RFC7585Tests::RETVAL_NOTRUNYET) {
              Severity: Major
              Found in core/diag/RFC7585Tests.php - About 2 hrs to fix

                Method mailAddressValidSecure has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function mailAddressValidSecure($address)
                    {
                        $loggerInstance = new \core\common\Logging();
                        if (!filter_var($address, FILTER_VALIDATE_EMAIL)) {
                            $loggerInstance->debug(4, "OutsideComm::mailAddressValidSecure: invalid mail address.");
                Severity: Major
                Found in core/common/OutsideComm.php - About 2 hrs to fix

                  File adminQuery.php has 254 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 web/diag/adminQuery.php - About 2 hrs to fix

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

                        private function sendOptionsToDatabase($object, array $options, array $pendingattributes, string $device = NULL, int $eaptype = NULL) {
                            $retval = [];
                            foreach ($options as $iterateOption) {
                                foreach ($iterateOption as $name => $optionPayload) {
                                    $optiontype = $this->optioninfoObject->optionType($name);
                    Severity: Minor
                    Found in web/lib/admin/OptionParser.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 createMsgbox has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function createMsgbox(type, onclick) {
                        var body = document.getElementsByTagName("body")[0];
                        if (document.getElementById("overlay") === null) {
                            var overlay = document.createElement("div");
                            overlay.setAttribute("id", "overlay");
                    Severity: Minor
                    Found in web/admin/js/popup_redirect.js - 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 saveNetworkProfileSeparateHS has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function saveNetworkProfileSeparateHS($profileName, $network)
                        {
                            $out = '';
                            if (!empty($network['ssid'])) {
                                if ($this::separateSSIDprofiles === true && !empty($network['condition']) && $network['condition'] === 'locally_defined') {
                    Severity: Minor
                    Found in devices/ms/DeviceW8W10.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 testSslscan has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function testSslscan()
                        {
                            $A = $this->getExecPath('sslscan'); 
                            if ($A['exec'] != "" && $A['exec_is'] == "EXPLICIT" && !file_exists($A['exec'])) { 
                                $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>sslscan</strong> is configured explicitly and was not found on your system!");    
                    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 getExternalDBEntityDetails has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getExternalDBEntityDetails($externalId, $realm = NULL)
                        {
                            $list = [];
                            if (\config\ConfAssistant::CONSORTIUM['name'] == "eduroam" && isset(\config\ConfAssistant::CONSORTIUM['deployment-voodoo']) && \config\ConfAssistant::CONSORTIUM['deployment-voodoo'] == "Operations Team") { // SW: APPROVED
                                $scanforrealm = "";
                    Severity: Minor
                    Found in core/CAT.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 setup has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        final public function setup(AbstractProfile $profile, $token = NULL, $importPassword = NULL, $openRoaming = 0)
                        {
                            $this->loggerInstance->debug(4, "module setup start\n");
                            common\Entity::intoThePotatoes();
                            $purpose = 'installer';
                    Severity: Minor
                    Found in core/DeviceConfig.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