howardjones/network-weathermap

View on GitHub

Showing 1,091 of 1,093 total issues

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

function weathermap_poller_bottom()
{
    global $config;
    global $weathermapPollerStartTime;

Severity: Minor
Found in lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php - About 1 hr to fix

    Method translateRuntimeOptionsToSettings has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function translateRuntimeOptionsToSettings()
        {
            global $weathermap_error_suppress;
    
            $this->configFile = $this->getOpt->getOption('config');
    Severity: Minor
    Found in lib/Weathermap/CLI/Runner.php - About 1 hr to fix

      Method testIndexOrphans has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testIndexOrphans()
          {
              # Check that all the little config XML files actually appear somewhere in the index.xml
              $docsIndex = $this->docsRoot . "/index.xml";
      
      
      Severity: Minor
      Found in lib/Weathermap/Tests/DocsTest.php - About 1 hr to fix

        Method drawRealIcon has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function drawRealIcon(&$map, $iconColour)
            {
                $this->iconfile = $map->processString($this->iconfile, $this);
        
                MapUtility::debug('Actual image-based icon from ' . $this->iconfile . " for $this->name\n");
        Severity: Minor
        Found in lib/Weathermap/Core/MapNode.php - About 1 hr to fix

          Function render has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              render() {
                  if (!this.state.map) {
                      return <div className='wm-map-properties-container wm-popup'>No such map? (or loading)</div>
                  }
          
          
          Severity: Minor
          Found in websrc/cacti-mgmt/src/components/MapProperties.js - About 1 hr to fix

            Method updateLink has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function updateLink($linkName, $params)
                {
                    if (!$this->isLoaded()) {
                        throw new WeathermapInternalFail("Map must be loaded before editing API called.");
                    }
            Severity: Minor
            Found in lib/Weathermap/Editor/Editor.php - About 1 hr to fix

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

                      } elseif ($hostname != '') {
                          $res3 =
                              db_fetch_row("select id,hostname from host where description='" . mysql_real_escape_string($hostname)
                                  . "'");
              
              
              Severity: Major
              Found in random-bits/cacti-integrate.php and 1 other location - About 1 hr to fix
              random-bits/cacti-integrate.php on lines 211..238

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

              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 ($address != '') {
                          $res2 = db_fetch_row("select id,description from host where hostname='" . mysql_real_escape_string($address)
                              . "'");
              
                          if ($res2) {
              Severity: Major
              Found in random-bits/cacti-integrate.php and 1 other location - About 1 hr to fix
              random-bits/cacti-integrate.php on lines 224..238

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

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

              function show_link(name) {
                  mapmode('existing');
              
                  hide_all_dialogs();
              
              
              Severity: Minor
              Found in editor-resources/editor.js - 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 configlist has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function configlist()
                  {
                      self::checkPaths();
              
                      $summaryFileName = self::$testSuiteDirectory . DIRECTORY_SEPARATOR . "summary.html";
              Severity: Minor
              Found in lib/Weathermap/Tests/ConfigTest.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 drawLegendVertical has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function drawLegendVertical($keyHeight = 400, $inverted = false)
                  {
                      $title = $this->keytitle;
              
                      $nScales = $this->scale->spanCount();
              Severity: Minor
              Found in lib/Weathermap/Core/Legend.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 getConfigSimple has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function getConfigSimple($simpleParameters, $comparison)
                  {
                      $output = '';
              
                      # TEMPLATE must come first. DEFAULT
              Severity: Minor
              Found in lib/Weathermap/Core/MapDataItem.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 importMapSettings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function importMapSettings($map)
                  {
                      global $weathermap_error_suppress;
              
                      # in the order of precedence - global extras, group extras, and finally map extras
              Severity: Minor
              Found in lib/Weathermap/Poller/MapRuntime.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 createThumbnailFile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function createThumbnailFile($thumbnailFileName, $thumbnailMaxSize, $imageRef)
                  {
                      MapUtility::debug("Writing thumbnail to $thumbnailFileName\n");
              
                      if (!function_exists('imagecopyresampled')) {
              Severity: Minor
              Found in lib/Weathermap/Core/Map.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 drawBandwidthLabels has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function drawBandwidthLabels($gdImage)
                  {
                      MapUtility::debug('Link ' . $this->name . ": Drawing bwlabels.\n");
              
                      $directions = $this->getDirectionList();
              Severity: Minor
              Found in lib/Weathermap/Core/MapLink.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 runOutputTest has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function runOutputTest($iconFileName, $imageFileName, $htmlFileName, $newConfigFileName)
                  {
                      $map = new Map();
              
                      $map->readConfig($iconFileName);
              Severity: Minor
              Found in lib/Weathermap/Tests/TestSupport.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 findIndexNearDistance has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function findIndexNearDistance($targetDistance)
                  {
                      $left = 0;
                      $right = count($this->elements) - 1;
              
              
              Severity: Minor
              Found in lib/Weathermap/Core/Spine.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 weathermap_poller_bottom has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              function weathermap_poller_bottom()
              {
                  global $config;
                  global $weathermapPollerStartTime;
              
              
              Severity: Minor
              Found in lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.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 via_link() {
                  hide_dialog('dlgLinkProperties');
                  document.getElementById('tb_help').innerText = 'Click on the map via which point you whant to redirect link.';
                  document.getElementById('action').value = "via_link";
                  mapmode('xy');
              Severity: Major
              Found in editor-resources/editor.js and 1 other location - About 1 hr to fix
              editor-resources/editor.js on lines 365..370

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

              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 move_node() {
                  hide_dialog('dlgNodeProperties');
                  document.getElementById('tb_help').innerText = 'Click on the map where you would like to move the node to.';
                  document.getElementById('action').value = "move_node";
                  mapmode('xy');
              Severity: Major
              Found in editor-resources/editor.js and 1 other location - About 1 hr to fix
              editor-resources/editor.js on lines 372..377

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

              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

              Severity
              Category
              Status
              Source
              Language