core/diag/RADIUSTestsUI.php

Summary

Maintainability
F
1 wk
Test Coverage

Function collectClients has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
Open

    private function collectClients()
    {
        $clientstest = [];
        foreach ($this->allReachabilityResults['clients'] as $clients) {
            $hostindex = $clients->hostindex; 
Severity: Minor
Found in core/diag/RADIUSTestsUI.php - About 1 day 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 RADIUSTestsUI.php has 457 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/RADIUSTestsUI.php - About 7 hrs to fix

    Function setGlobalDynamicResult has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
    Open

        public function setGlobalDynamicResult()
        {
            foreach ($this->allReachabilityResults['capath'] as $capath) {
                $this->globalLevelDynamic = max($this->globalLevelDynamic, $capath->level);
            }
    Severity: Minor
    Found in core/diag/RADIUSTestsUI.php - About 6 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

    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

    Method printOverview has 90 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function printOverview()
        {
            $out = [];
            $out[] = "<fieldset class='option_container'>
            <legend>
    Severity: Major
    Found in core/diag/RADIUSTestsUI.php - About 3 hrs to fix

      Method collectClients has 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function collectClients()
          {
              $clientstest = [];
              foreach ($this->allReachabilityResults['clients'] as $clients) {
                  $hostindex = $clients->hostindex; 
      Severity: Major
      Found in core/diag/RADIUSTestsUI.php - About 3 hrs to fix

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

            public function printStatic()
            {
                $out = [];
                $out[] = '<fieldset class="option_container" id="static_tests">
                          <legend><strong>';
        Severity: Minor
        Found in core/diag/RADIUSTestsUI.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

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

            public function __construct($token)
            {
                parent::__construct();
                $this->globalInfo = [
                    \core\common\Entity::L_OK => _("All tests passed."),
        Severity: Major
        Found in core/diag/RADIUSTestsUI.php - About 2 hrs to fix

          Function __construct has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __construct($token)
              {
                  parent::__construct();
                  $this->globalInfo = [
                      \core\common\Entity::L_OK => _("All tests passed."),
          Severity: Minor
          Found in core/diag/RADIUSTestsUI.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

          Method collectCAPath has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function collectCAPath()
              {
                  $capathtest = [];
                  $capathtest[] = '<p><strong>'._("Checking server handshake...")."</strong><p>";
                  foreach ($this->allReachabilityResults['capath'] as $capath) {
          Severity: Major
          Found in core/diag/RADIUSTestsUI.php - About 2 hrs to fix

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

                public function printStatic()
                {
                    $out = [];
                    $out[] = '<fieldset class="option_container" id="static_tests">
                              <legend><strong>';
            Severity: Minor
            Found in core/diag/RADIUSTestsUI.php - About 1 hr to fix

              Method setGlobalDynamicResult has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function setGlobalDynamicResult()
                  {
                      foreach ($this->allReachabilityResults['capath'] as $capath) {
                          $this->globalLevelDynamic = max($this->globalLevelDynamic, $capath->level);
                      }
              Severity: Minor
              Found in core/diag/RADIUSTestsUI.php - About 1 hr to fix

                Method printDynamic has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function printDynamic()
                    {
                        $out = [];
                        $out[] = "<div id='dynamic_tests'><fieldset class='option_container'>
                            <legend><strong>"._("DYNAMIC connectivity tests")."</strong></legend>";
                Severity: Minor
                Found in core/diag/RADIUSTestsUI.php - About 1 hr to fix

                  Function printDynamic has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function printDynamic()
                      {
                          $out = [];
                          $out[] = "<div id='dynamic_tests'><fieldset class='option_container'>
                              <legend><strong>"._("DYNAMIC connectivity tests")."</strong></legend>";
                  Severity: Minor
                  Found in core/diag/RADIUSTestsUI.php - About 35 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

                  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 243..256

                  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 258..271

                  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

                  There are no issues that match your filters.

                  Category
                  Status