Showing 599 of 599 total issues

AbstractProfile has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class AbstractProfile extends EntityWithDBProperties
{

    const HIDDEN = -1;
    const AVAILABLE = 0;
Severity: Minor
Found in core/AbstractProfile.php - About 3 hrs to fix

    File IdP.php has 311 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/IdP.php - About 3 hrs to fix

      File Telepath.php has 311 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/diag/Telepath.php - About 3 hrs to fix

        Method sanitiseInputs has 85 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function sanitiseInputs(array $listOfEntries) {
                $retval = [];
                $bad = [];
                $multilangAttrsWithC = [];
                foreach ($listOfEntries as $objId => $objValueRaw) {
        Severity: Major
        Found in web/lib/admin/OptionParser.php - About 3 hrs to fix

          RADIUSTests has 28 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class RADIUSTests extends AbstractTest {
          
              /**
               * Was the reachability check executed already?
               * 
          Severity: Minor
          Found in core/diag/RADIUSTests.php - About 3 hrs to fix

            File OutsideComm.php has 305 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/common/OutsideComm.php - About 3 hrs to fix

              Method networkBlock has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function networkBlock($blocktype, $toBeConfigured, $prettyName)
                  {
                      \core\common\Entity::intoThePotatoes();
                      $eapType = $this->selectedEap;
                      switch ($blocktype) {
              Severity: Major
              Found in devices/apple_mobileconfig/MobileconfigSuperclass.php - About 3 hrs to fix

                File CertificationAuthorityEduPki.php has 303 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/CertificationAuthorityEduPki.php - About 3 hrs to fix

                  Function deleteObsoleteTempDirs has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function deleteObsoleteTempDirs() {
                          $downloadsDirs = [
                              'site_installers' => dirname(dirname(dirname(dirname(__FILE__)))) . "/var/installer_cache",
                              'silverbullet' => dirname(dirname(dirname(dirname(__FILE__)))) . "/var/silverbullet"
                          ];
                  Severity: Minor
                  Found in web/lib/admin/Maintenance.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

                  Function mailAddressValidSecure has a Cognitive Complexity of 23 (exceeds 5 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: Minor
                  Found in core/common/OutsideComm.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

                  Function adminInvitationMail has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function adminInvitationMail($targets, $introtext, $newtoken, $idpPrettyName, $federation, $type)
                      {
                          if (!in_array($introtext, OutsideComm::INVITE_CONTEXTS)) {
                              throw new \Exception("Unknown invite mode!");
                          }
                  Severity: Minor
                  Found in core/common/OutsideComm.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

                  Function extractIncomingCertsfromEAP has a Cognitive Complexity of 23 (exceeds 5 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: Minor
                  Found in core/diag/RADIUSTests.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

                  Method marshalObject has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function marshalObject($domElement, $node, $name, $object, $namespace = NULL, $root = false)
                      {
                          if (is_null($object)) {
                              return;
                          }
                  Severity: Major
                  Found in core/DeviceXMLmain.php - About 3 hrs to fix

                    InputValidation has 27 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class InputValidation extends \core\common\Entity
                    {
                    
                        /**
                         * returns a simple HTML <p> element with basic explanations about what was
                    Severity: Minor
                    Found in web/lib/common/InputValidation.php - About 3 hrs to fix

                      Function enumerateOptionsToDisplay has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function enumerateOptionsToDisplay($class, $fed, $device='')
                          {
                              $optioninfo = \core\Options::instance();
                              $loggerInstance = new \core\common\Logging();
                              $list = $optioninfo->availableOptions($class);
                      Severity: Minor
                      Found in web/lib/admin/OptionDisplay.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

                      Function testDefaults has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function testDefaults()
                          {
                              $defaultvalues = "";
                              $missingvalues = "";
                              // all the checks for equality with a shipped default value
                      Severity: Minor
                      Found in core/SanityTests.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

                      Function propertyCheckServercert has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function propertyCheckServercert(&$servercert) {
                      // we share the same checks as for CAs when it comes to signature algorithm and basicconstraints
                      // so call that function and memorise the outcome
                              $returnarray = $this->propertyCheckIntermediate($servercert, TRUE);
                              $sANdns = [];
                      Severity: Minor
                      Found in core/diag/RADIUSTests.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

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

                          public function writeLANprofile()
                          {
                              $rootname = 'LANProfile';        
                              $dom = new \DOMDocument('1.0', 'utf-8');
                              $root = $dom->createElement($rootname);
                      Severity: Major
                      Found in devices/ms/MsLanProfile.php and 1 other location - About 3 hrs to fix
                      devices/ms/MsWlanProfile.php on lines 70..83

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

                      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 writeWLANprofile()
                          {
                              $rootname = 'WLANProfile';
                              $dom = new \DOMDocument('1.0', 'utf-8');
                              $root = $dom->createElement($rootname);
                      Severity: Major
                      Found in devices/ms/MsWlanProfile.php and 1 other location - About 3 hrs to fix
                      devices/ms/MsLanProfile.php on lines 27..40

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

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

                          public function writeInstaller()
                          {
                              \core\common\Entity::intoThePotatoes();
                              $rootname = 'EAPIdentityProviderList';
                              $dom = new \DOMDocument('1.0', 'utf-8');
                      Severity: Major
                      Found in devices/eap_config/DeviceXML.php - About 3 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language