Showing 503 of 577 total issues

Function prompt_nonempty_string has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    def prompt_nonempty_string(self, show: int, prompt: str, val: str = '') -> str:
        """
        Prompt user for input
        """
        if self.graphics == 'tty':
Severity: Minor
Found in devices/linux/Files/main.py - About 5 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

File DeploymentManaged.php has 381 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/DeploymentManaged.php - About 5 hrs to fix

    File UserAPI.php has 378 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/UserAPI.php - About 5 hrs to fix

      Method signRequest has 125 lines of code (exceeds 25 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: Major
      Found in core/CertificationAuthorityEduPki.php - About 5 hrs to fix

        Function findLoginIdPByEmail has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function findLoginIdPByEmail($mail, $lang)
            {
                $loggerInstance = new common\Logging();
                $listOfProviders = [];
                $matchedProviders = [];
        Severity: Minor
        Found in core/User.php - About 4 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 tlsClientSideCheck has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

            public function tlsClientSideCheck(string $host)
            {
                $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 4 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

        File UIElements.php has 369 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/lib/admin/UIElements.php - About 4 hrs to fix

          File overview_federation.php has 363 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/admin/overview_federation.php - About 4 hrs to fix

            Function exec has a Cognitive Complexity of 31 (exceeds 5 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: Minor
            Found in core/DBConnection.php - About 4 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

            File WindowsCommon.php has 357 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/WindowsCommon.php - About 4 hrs to fix

              File CertificationAuthorityEduPkiServer.php has 353 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              /*
               * ******************************************************************************
               * Copyright 2011-2017 DANTE Ltd. and GÉANT on behalf of the GN3, GN3+, GN4-1 
              Severity: Minor
              Found in core/CertificationAuthorityEduPkiServer.php - About 4 hrs to fix

                Function postProcessValidAttributes has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function postProcessValidAttributes(array $options, array &$good, array &$bad) {
                        foreach ($options as $index => $iterateOption) {
                            foreach ($iterateOption as $name => $optionPayload) {
                                switch ($name) {
                                    case "eap:ca_url": // eap:ca_url becomes eap:ca_file by downloading the file
                Severity: Minor
                Found in web/lib/admin/OptionParser.php - About 4 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 collectCAPath has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function collectCAPath()
                    {
                        $capathtest = [];
                        $capathtest[] = '<p><strong>'._("Checking server handshake...")."</strong><p>";
                        foreach ($this->allReachabilityResults['capath'] as $capath) {
                Severity: Minor
                Found in core/diag/RADIUSTestsUI.php - About 4 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

                File OptionParser.php has 343 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/lib/admin/OptionParser.php - About 4 hrs to fix

                  Function printOverview has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function printOverview()
                      {
                          $out = [];
                          $out[] = "<fieldset class='option_container'>
                          <legend>
                  Severity: Minor
                  Found in core/diag/RADIUSTestsUI.php - About 4 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 ask has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def ask(self, question: str, prompt: str = '', default: bool = None) -> int:
                          """
                          Prompt user for a Y/N reply, possibly supplying a default answer
                          """
                          if self.silent:
                  Severity: Minor
                  Found in devices/linux/Files/main.py - About 4 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 sendRequestToCa has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function sendRequestToCa($csr, $revocationPin, $expiryDays): int
                      {
                          // initialise connection to eduPKI CA / eduroam RA and send the request to them
                          try {            
                              if (in_array("eduroam IdP", $csr["POLICIES"]) && in_array("eduroam SP", $csr["POLICIES"])) {
                  Severity: Major
                  Found in core/CertificationAuthorityEduPkiServer.php - About 4 hrs to fix

                    File OptionDisplay.php has 336 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/lib/admin/OptionDisplay.php - About 4 hrs to fix

                      File Federation.php has 334 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/Federation.php - About 4 hrs to fix

                        Function determineMailsToSend has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function determineMailsToSend() {
                                $this->mailQueue = [];
                        // check for IDP_EXISTS_BUT_NO_DATABASE
                                if (!in_array(AbstractTest::INFRA_NONEXISTENTREALM, $this->possibleFailureReasons) && $this->additionalFindings[AbstractTest::INFRA_NONEXISTENTREALM]['DATABASE_STATUS']['ID2'] < 0) {
                                    $this->mailQueue[] = Logopath::IDP_EXISTS_BUT_NO_DATABASE;
                        Severity: Minor
                        Found in core/diag/Logopath.php - About 3 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