Showing 599 of 599 total issues

DeviceConfig has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class DeviceConfig extends \core\common\Entity
{

    /**
     * stores the path to the temporary working directory for a module instance
Severity: Minor
Found in core/DeviceConfig.php - About 2 hrs to fix

    Method displayName has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function displayName($input) {
            \core\common\Entity::intoThePotatoes();
            $ssidText = _("SSID");
            $passpointOiText = _("HS20 Consortium OI");
    
    
    Severity: Major
    Found in web/lib/admin/UIElements.php - About 2 hrs to fix

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

          public function __construct()
          {
              parent::__construct();
              \core\common\Entity::intoThePotatoes();
              $this->previousQuestions = $_SESSION['EVIDENCE']['QUESTIONSASKED'] ?? [];
      Severity: Major
      Found in core/diag/Sociopath.php - About 2 hrs to fix

        Function update_table has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public function update_table($table_name) {
                $table = 'view_'.$table_name;
                $tmp_table = 'tmp_'.$table_name;
                if ($this->tablesource[$table_name] == 'eduroam') {
                    $this->db_local->select_db('monitor_copy');
        Severity: Minor
        Found in utils/update_monitor_copy.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 getNetworks has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            private function getNetworks()
            {
                $additionalConsortia = [];
                $additionalSSIDs = [];
                $ssids = $this->getConfigSSIDs();
        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

        Function genericAPIStatus has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            private function genericAPIStatus($type, $param1 = NULL, $param2 = NULL)
            {
                $endpoints = [
                    'tlr_test' => "https://monitor.eduroam.org/mapi/index.php?type=tlr_test&tlr=$param1",
                    'federation_via_tlr' => "https://monitor.eduroam.org/mapi/index.php?type=federation_via_tlr&federation=$param1",
        Severity: Minor
        Found in core/diag/Telepath.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 createCArepository has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            private function createCArepository($tmpDir, &$intermOdditiesCAT, $servercert, $eapIntermediates, $eapIntermediateCRLs) {
                if (!mkdir($tmpDir . "/root-ca-allcerts/", 0700, true)) {
                    throw new Exception("unable to create root CA directory (RADIUS Tests): $tmpDir/root-ca-allcerts/\n");
                }
                if (!mkdir($tmpDir . "/root-ca-eaponly/", 0700, true)) {
        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

        Function setLang has a Cognitive Complexity of 19 (exceeds 5 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 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 udpLogin has a Cognitive Complexity of 19 (exceeds 5 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: 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

        Function __get_p12_cred has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def __get_p12_cred(self):
                """get the password for the PFX file"""
                if Config.eap_inner == 'SILVERBULLET':
                    self.__save_sb_pfx()
                else:
        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

        Function isEapTypeDefinitionComplete has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public function isEapTypeDefinitionComplete($eaptype)
            {
                if ($eaptype->needsServerCACert() && $eaptype->needsServerName()) {
                    $missing = [];
                    // silverbullet needs a support email address configured
        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

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

        array_push($FAQ, [
            'title' => sprintf(_("Is it safe to use %s installers?"), \config\Master::APPEARANCE['productname']),
            'text' => sprintf(_("%s installers configure security settings on your device, therefore you should be sure that you are using genuine ones."), \config\Master::APPEARANCE['productname']) . ' ' . ( isset(\config\ConfAssistant::CONSORTIUM['signer_name']) && \config\ConfAssistant::CONSORTIUM['signer_name'] != "" ? sprintf(_("This is why %s installers are digitally signed by %s. Watch out for a system message confirming this."), \config\Master::APPEARANCE['productname'], \config\ConfAssistant::CONSORTIUM['signer_name']) : ""),
        ]);
        Severity: Major
        Found in web/user/faq.php and 1 other location - About 2 hrs to fix
        web/user/faq.inc.php on lines 46..49

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

        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' => sprintf(_("Is it safe to use %s installers?"), \config\Master::APPEARANCE['productname']),
                'text' => sprintf(_("%s installers configure security settings on your device, therefore you should be sure that you are using genuine ones."), \config\Master::APPEARANCE['productname']) . ' ' . ( isset(\config\ConfAssistant::CONSORTIUM['signer_name']) && \config\ConfAssistant::CONSORTIUM['signer_name'] != "" ? sprintf(_("This is why %s installers are digitally signed by %s. Watch out for a system message confirming this."), \config\Master::APPEARANCE['productname'], \config\ConfAssistant::CONSORTIUM['signer_name']) : ""),
            ],
        Severity: Major
        Found in web/user/faq.inc.php and 1 other location - About 2 hrs to fix
        web/user/faq.php on lines 51..54

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

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

          Method extractIncomingCertsfromEAP has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function extractIncomingCertsfromEAP(&$testresults, $tmpDir) {
                  /*
                   *  EAP's house rules:
                   * 1) it is unnecessary to include the root CA itself (adding it has
                   *    detrimental effects on performance)
          Severity: Major
          Found in core/diag/RADIUSTests.php - About 2 hrs to fix

            File overview_sp.php has 271 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_sp.php - About 2 hrs to fix

              Method infoblock has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function infoblock(array $optionlist, string $class, string $level) {
                      \core\common\Entity::intoThePotatoes();
                      $locationMarkers = [];
                      $retval = "";
                      $optioninfo = \core\Options::instance();
              Severity: Major
              Found in web/lib/admin/UIElements.php - About 2 hrs to fix

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

                    public function generateCompatibleCsr($privateKey, $fed, $username): array
                    {
                        $newCsr = openssl_csr_new(
                                ['O' => \config\ConfAssistant::CONSORTIUM['name'],
                                    'OU' => $fed,
                Severity: Major
                Found in core/CertificationAuthorityEmbeddedRSA.php and 1 other location - About 2 hrs to fix
                core/CertificationAuthorityEmbeddedECDSA.php on lines 230..251

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

                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

                    public function generateCompatibleCsr($privateKey, $fed, $username): array
                    {
                        $newCsr = openssl_csr_new(
                                ['O' => \config\ConfAssistant::CONSORTIUM['name'],
                                    'OU' => $fed,
                Severity: Major
                Found in core/CertificationAuthorityEmbeddedECDSA.php and 1 other location - About 2 hrs to fix
                core/CertificationAuthorityEmbeddedRSA.php on lines 230..251

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

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

                    public function getExternalDBSyncCandidates($type)
                    {
                        $usedarray = [];
                        $matchingCandidates = [];
                        $syncstate = self::EXTERNAL_DB_SYNCSTATE_SYNCED;
                Severity: Minor
                Found in core/IdP.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