Showing 599 of 599 total issues

Method createCArepository has 48 lines of code (exceeds 25 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 1 hr to fix

    Function previewCAinHTML has a Cognitive Complexity of 15 (exceeds 5 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: Minor
    Found in web/lib/admin/UIElements.php - About 1 hr 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 checkUploadSanity has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

            private function checkUploadSanity(string $optiontype, string $incomingBinary) {
            switch ($optiontype) {
                case "general:logo_file":
                case "fed:logo_file":
                case "internal:logo_from_url":
    Severity: Minor
    Found in web/lib/admin/OptionParser.php - About 1 hr 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 furtherStringChecks has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        private function furtherStringChecks($attribute, $previsionalContent, &$bad) {
            $content = FALSE;
            switch ($attribute) {
                case "media:consortium_OI":
                    $content = $this->validator->consortiumOI($previsionalContent);
    Severity: Minor
    Found in web/lib/admin/OptionParser.php - About 1 hr 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 writeConfigVars has a Cognitive Complexity of 15 (exceeds 5 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: Minor
    Found in devices/linux/DeviceLinuxSh.php - About 1 hr 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 newIdP has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function newIdP($type, $ownerId, $level, $mail = NULL, $bestnameguess = NULL)
        {
            $this->databaseHandle->exec("INSERT INTO institution (country, type) VALUES('$this->tld', '$type')");
            $identifier = $this->databaseHandle->lastID();
    
    
    Severity: Minor
    Found in core/Federation.php - About 1 hr 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 getIdpDistance has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function getIdpDistance($idp, $location)
        {
            $dist = 10000;
            if (isset($idp['geo'])) {
                $G = $idp['geo'];
    Severity: Minor
    Found in core/IdPlist.php - About 1 hr 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 determineOwnCatalogue has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function determineOwnCatalogue($showTrace = FALSE)
        {
            $trace = debug_backtrace();
            $caller = [];
            // find the first caller in the stack trace which is NOT "Entity" itself
    Severity: Minor
    Found in core/common/Entity.php - About 1 hr 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 createIdPFromToken has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function createIdPFromToken(string $token, string $owner)
        {
            new CAT(); // be sure that Entity's static members are initialised
            common\Entity::intoThePotatoes();
            // the token either has cat_institution_id set -> new admin for existing inst
    Severity: Minor
    Found in core/UserManagement.php - About 1 hr 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 sendRequestToCa has a Cognitive Complexity of 15 (exceeds 5 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: Minor
    Found in core/CertificationAuthorityEduPkiServer.php - About 1 hr 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 thoroughChainChecks has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        private function thoroughChainChecks(&$testresults, &$intermOdditiesCAT, $tmpDir, $servercert, $eapIntermediates, $eapIntermediateCRLs) {
    
            $crlCheckString = $this->createCArepository($tmpDir, $intermOdditiesCAT, $servercert, $eapIntermediates, $eapIntermediateCRLs);
    // ... and run the verification test
            $verifyResultEaponly = [];
    Severity: Minor
    Found in core/diag/RADIUSTests.php - About 1 hr 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 __validate_user_name has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def __validate_user_name(self) -> bool:
            # locate the @ character in username
            pos = self.username.find('@')
            debug("@ position: " + str(pos))
            # trailing @
    Severity: Minor
    Found in devices/linux/Files/main.py - About 1 hr 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 relevantNAPTRcompliance has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function relevantNAPTRcompliance()
        {
    // did we query DNS for the NAPTRs yet? If not, do so now.
            if ($this->NAPTR_executed == RFC7585Tests::RETVAL_NOTRUNYET) {
                $this->relevantNAPTR();
    Severity: Minor
    Found in core/diag/RFC7585Tests.php - About 1 hr 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

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

    function createQRWindow() {
        if (this.readyState === 4 && this.status === 200) {
            var qrBox;
            qrBox = createMsgbox("qr");
            qrBox.innerHTML += this.responseText;
    Severity: Major
    Found in web/admin/js/popup_redirect.js and 1 other location - About 1 hr to fix
    web/admin/js/popup_redirect.js on lines 160..167

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

    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

    function createWindow() {
        if (this.readyState === 4 && this.status === 200) {
            var infoBox;
            infoBox = createMsgbox("info");
            infoBox.innerHTML += this.responseText;
    Severity: Major
    Found in web/admin/js/popup_redirect.js and 1 other location - About 1 hr to fix
    web/admin/js/popup_redirect.js on lines 169..176

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

    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 __construct has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct($identifier, $certtype = NULL)
        {
            $this->databaseType = "INST";
            parent::__construct();
            $this->username = "";
    Severity: Minor
    Found in core/SilverbulletCertificate.php - About 1 hr to fix

      Method sendSMS has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function sendSMS($number, $content)
          {
              $loggerInstance = new \core\common\Logging();
              switch (\config\ConfAssistant::SMSSETTINGS['provider']) {
                  case 'Nexmo':
      Severity: Minor
      Found in core/common/OutsideComm.php - About 1 hr to fix

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

                    if ($this->naptr > 0 && $this->naptrValid == \core\diag\RADIUSTests::RETVAL_OK && $this->srv > 0) {
                        $out[] = "<tr><td>"._("Checking IP address resolution:")."</td><td>";
                        switch ($this->srv) {
                            case \core\diag\RADIUSTests::RETVAL_SKIPPED:
                                $out[] = _("This check was skipped.");
        Severity: Major
        Found in core/diag/RADIUSTestsUI.php and 1 other location - About 1 hr to fix
        core/diag/RADIUSTestsUI.php on lines 260..273

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

        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 ($this->naptr > 0 && $this->naptrValid == \core\diag\RADIUSTests::RETVAL_OK) {
                        $out[] = "<tr><td>"._("Checking SRVs:")."</td><td>";
                        switch ($this->srv) {
                            case \core\diag\RADIUSTests::RETVAL_SKIPPED:
                                $out[] = _("This check was skipped.");
        Severity: Major
        Found in core/diag/RADIUSTestsUI.php and 1 other location - About 1 hr to fix
        core/diag/RADIUSTestsUI.php on lines 275..288

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

        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 createMsgbox has 46 lines of code (exceeds 25 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 1 hr to fix
          Severity
          Category
          Status
          Source
          Language