Showing 599 of 599 total issues

Method generateCompatibleCsr has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function generateCompatibleCsr($privateKey, $fed, $username): array
    {
        $tempdirArray = \core\common\Entity::createTemporaryDirectory("test");
        $tempdir = $tempdirArray['dir'];
        // dump private key into directory
Severity: Minor
Found in core/CertificationAuthorityEduPki.php - About 1 hr to fix

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

                            if ($naptr > 0 && $naptr_valid == \core\diag\RADIUSTests::RETVAL_OK && $srv > 0) {
                                $hosts = $rfc7585suite->relevantNAPTRhostnameResolution();
                                echo "<tr><td>" . _("Checking IP address resolution:") . "</td><td>";
                                switch ($srv) {
                                    case \core\diag\RADIUSTests::RETVAL_SKIPPED:
    Severity: Major
    Found in web/diag/action_realmcheck.php and 1 other location - About 1 hr to fix
    web/diag/action_realmcheck.php on lines 657..671

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

    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

                            if ($naptr > 0 && $naptr_valid == \core\diag\RADIUSTests::RETVAL_OK) {
                                $srv = $rfc7585suite->relevantNAPTRsrvResolution();
                                echo "<tr><td>" . _("Checking SRVs:") . "</td><td>";
                                switch ($srv) {
                                    case \core\diag\RADIUSTests::RETVAL_SKIPPED:
    Severity: Major
    Found in web/diag/action_realmcheck.php and 1 other location - About 1 hr to fix
    web/diag/action_realmcheck.php on lines 673..687

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

    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

    Consider simplifying this complex logical expression.
    Open

            if ($this->idPFederation !== NULL &&
                    $this->visitedFlr !== NULL &&
                    !array_key_exists(AbstractTest::INFRA_ETLR, $this->possibleFailureReasons) &&
                    !array_key_exists(AbstractTest::INFRA_LINK_ETLR_NRO_IDP, $this->possibleFailureReasons) &&
                    !array_key_exists(AbstractTest::INFRA_NRO_IDP, $this->possibleFailureReasons) &&
    Severity: Major
    Found in core/diag/Telepath.php - About 1 hr to fix

      Method executeEapolTest has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private function executeEapolTest($tmpDir, $probeindex, $eaptype, $outerUser, $innerUser, $password, $opnameCheck, $frag) {
      Severity: Major
      Found in core/diag/RADIUSTests.php - About 1 hr to fix

        Function sanityTestResultHTML has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function sanityTestResultHTML($test) {
                $out = '';
                switch ($test->test_result['global']) {
                    case \core\common\Entity::L_OK:
                        $message = "Your configuration appears to be fine.";
        Severity: Minor
        Found in web/lib/admin/UIElements.php - About 55 mins 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 eapBlock has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            private function eapBlock($caRefs)
            {
                $selectedEap = $this->selectedEap;
                $outerId = $this->determineOuterIdString();
                $eapPrettyprint = \core\common\EAP::eapDisplayName($selectedEap);
        Severity: Minor
        Found in devices/chromebook/DeviceChromebook.php - About 55 mins 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 runTests has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function runTests($Tests)
            {
                foreach ($Tests as $testName) {
                    $matchArray = [];
                    if (preg_match('/(.+)=>(.+)/', $testName, $matchArray)) {
        Severity: Minor
        Found in core/SanityTests.php - About 55 mins 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 triggerNewOCSPStatement has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function triggerNewOCSPStatement($serial): string
            {
                $cert = new SilverbulletCertificate($serial, \devices\Devices::SUPPORT_EMBEDDED_RSA);
                $certstatus = "";
                // get all relevant info from object properties
        Severity: Minor
        Found in core/CertificationAuthorityEmbeddedRSA.php - About 55 mins 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 detectOS has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function detectOS()
            {
                $Dev = \devices\Devices::listDevices();
                $devId = $this->deviceFromRequest();
                if ($devId !== NULL) {
        Severity: Minor
        Found in core/UserAPI.php - About 55 mins 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 getSSIDs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            private function getSSIDs()
            {
                $ssidList = [];
                $ssidList['add'] = [];
                $ssidList['del'] = [];
        Severity: Minor
        Found in core/DeviceConfig.php - About 55 mins 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 triggerNewOCSPStatement has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function triggerNewOCSPStatement($serial): string
            {
                $cert = new SilverbulletCertificate($serial, \devices\Devices::SUPPORT_EMBEDDED_ECDSA);
                $certstatus = "";
                // get all relevant info from object properties
        Severity: Minor
        Found in core/CertificationAuthorityEmbeddedECDSA.php - About 55 mins 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 levelPrecedenceAttributeJoin has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function levelPrecedenceAttributeJoin($existing, $new, $newlevel)
            {
                foreach ($new as $attrib) {
                    $ignore = "";
                    foreach ($existing as $approvedAttrib) {
        Severity: Minor
        Found in core/EntityWithDBProperties.php - About 55 mins 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 relevantNAPTR has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function relevantNAPTR()
            {
                if ($this->discoveryTag == "") {
                    $this->NAPTR_executed = RADIUSTests::RETVAL_NOTCONFIGURED;
                    return RADIUSTests::RETVAL_NOTCONFIGURED;
        Severity: Minor
        Found in core/diag/RFC7585Tests.php - About 55 mins 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 alert has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def alert(self, text: str) -> None:
                """Generate alert message"""
                if self.silent:
                    return
                if self.graphics == 'tty':
        Severity: Minor
        Found in devices/linux/Files/main.py - About 55 mins 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 readyForShowtime has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            private function readyForShowtime()
            {
                $properConfig = FALSE;
                $attribs = $this->getCollapsedAttributes();
                // do we have enough to go live? Check if any of the configured EAP methods is completely configured ...
        Severity: Minor
        Found in core/AbstractProfile.php - About 55 mins 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 show_info has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def show_info(self, data: str) -> None:
                """
                Show a piece of information
                """
                if self.silent:
        Severity: Minor
        Found in devices/linux/Files/main.py - About 55 mins 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 incrementDownloadStats has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function incrementDownloadStats($device, $area, $openRoaming)
            {
                if ($area == "admin" || $area == "user" || $area == "silverbullet") {
                    $lang = $this->languageInstance->getLang();
                    $this->frontendHandle->exec("INSERT INTO downloads (profile_id, device_id, lang, openroaming, downloads_$area) VALUES (? ,?, ?, ?, 1) ON DUPLICATE KEY UPDATE downloads_$area = downloads_$area + 1", "issi", $this->identifier, $device, $lang, $openRoaming);
        Severity: Minor
        Found in core/AbstractProfile.php - About 55 mins 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 udpLogin has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function udpLogin($probeindex, $eaptype, $innerUser, $password, $opnameCheck = TRUE, $frag = TRUE, $clientcertdata = NULL) {
        Severity: Major
        Found in core/diag/RADIUSTests.php - About 50 mins to fix

          Method saveDownloadDetails has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              protected function saveDownloadDetails($idpIdentifier, $profileId, $deviceId, $area, $lang, $eapType, $openRoaming)
          Severity: Major
          Found in core/AbstractProfile.php - About 50 mins to fix
            Severity
            Category
            Status
            Source
            Language