howardjones/network-weathermap

View on GitHub

Showing 1,091 of 1,093 total issues

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

<?php
// Pluggable datasource for PHP Weathermap 0.9
// - return a live SNMP value

// doesn't work well with large values like interface counters (I think this is a rounding problem)
Severity: Major
Found in lib/Weathermap/Plugins/Datasources/SNMP2c.php and 1 other location - About 5 days to fix
lib/Weathermap/Plugins/Datasources/SNMP1.php on lines 1..152

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

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

<?php
// Pluggable datasource for PHP Weathermap 0.9
// - return a live SNMP value

// doesn't work well with large values like interface counters (I think this is a rounding problem)
Severity: Major
Found in lib/Weathermap/Plugins/Datasources/SNMP1.php and 1 other location - About 5 days to fix
lib/Weathermap/Plugins/Datasources/SNMP2c.php on lines 1..151

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

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

File Map.php has 1266 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Weathermap\Core;

// PHP Weathermap 0.98
Severity: Major
Found in lib/Weathermap/Core/Map.php - About 3 days to fix

    File WeatherMapCactiManagementPlugin.php has 1237 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Weathermap\Integrations\Cacti;
    
    require_once dirname(__FILE__) . "/database.php";
    Severity: Major
    Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.php - About 3 days to fix

      File MapNode.php has 972 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      // PHP Weathermap 0.98
      // Copyright Howard Jones, 2005-2016 howie@thingy.com
      // http://www.network-weathermap.com/
      // PHP Weathermap is licensed under the MIT License, see LICENSE file for more information.
      Severity: Major
      Found in lib/Weathermap/Core/MapNode.php - About 2 days to fix

        File EditorUI.php has 910 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        // PHP Weathermap 0.97b
        // Copyright Howard Jones, 2005-2012 howie@thingy.com
        // http://www.network-weathermap.com/
        // PHP Weathermap is licensed under the MIT License, see LICENSE file for more information.
        Severity: Major
        Found in lib/Weathermap/Editor/EditorUI.php - About 2 days to fix

          File Editor.php has 813 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          // PHP Weathermap 0.97b
          // Copyright Howard Jones, 2005-2012 howie@thingy.com
          // http://www.network-weathermap.com/
          // PHP Weathermap is licensed under the MIT License, see LICENSE file for more information.
          Severity: Major
          Found in lib/Weathermap/Editor/Editor.php - About 1 day to fix

            File MapManager.php has 675 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            namespace Weathermap\Integrations;
            
            use PDO;
            Severity: Major
            Found in lib/Weathermap/Integrations/MapManager.php - About 1 day to fix

              File MapLink.php has 643 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              // PHP Weathermap 0.98
              // Copyright Howard Jones, 2005-2016 howie@thingy.com
              // http://www.network-weathermap.com/
              // PHP Weathermap is licensed under the MIT License, see LICENSE file for more information.
              Severity: Major
              Found in lib/Weathermap/Core/MapLink.php - About 1 day to fix

                Function readData has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function readData($targetString, &$map, &$mapItem)
                    {
                        $this->data[IN] = null;
                        $this->data[OUT] = null;
                        $this->dataTime = time();
                Severity: Minor
                Found in lib/Weathermap/Plugins/Datasources/CactiTholdStatus.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

                Map has 63 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Map extends MapBase
                {
                    /** @var MapNode[] $nodes */
                    public $nodes = array();
                    /** @var MapLink[] $links */
                Severity: Major
                Found in lib/Weathermap/Core/Map.php - About 1 day to fix

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

                  class Selector extends Component {
                    /** props
                     id
                     value
                     options: {name: string, id: any}
                  Severity: Major
                  Found in websrc/cacti-user/src/components/Selector.js and 1 other location - About 1 day to fix
                  websrc/cacti-mgmt/src/components/Selector.js on lines 3..28

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

                  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

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

                  class Selector extends Component {
                    /** props
                     id
                     value
                     options: {name: string, id: any}
                  Severity: Major
                  Found in websrc/cacti-mgmt/src/components/Selector.js and 1 other location - About 1 day to fix
                  websrc/cacti-user/src/components/Selector.js on lines 3..28

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

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

                  function weathermap_draw_navigation_text($nav)
                  {
                      $nav["weathermap-cacti88-plugin.php:"] = array(
                          "title" => "Weathermap",
                          "mapping" => "index.php:",
                  Severity: Major
                  Found in lib/Weathermap/Integrations/Cacti/cacti88-plugin-hooks.php - About 1 day to fix

                    Function addmapPicker has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function addmapPicker(
                            $showAllFiles = false
                        ) {
                            $loaded = array();
                            $flags = array();
                    Severity: Minor
                    Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.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 WeatherMapCactiUserPlugin.php has 497 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    namespace Weathermap\Integrations\Cacti;
                    
                    require_once dirname(__FILE__) . "/database.php";
                    Severity: Minor
                    Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php - About 7 hrs to fix

                      MapManager has 54 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class MapManager
                      {
                      
                          /** @var PDO $pdo */
                          private $pdo;
                      Severity: Major
                      Found in lib/Weathermap/Integrations/MapManager.php - About 7 hrs to fix

                        File editor.js has 481 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        // global variable for subwindow reference
                        
                        var newWindow;
                        
                        // seed the help text. Done in a big lump here, so we could make a foreign language version someday.
                        Severity: Minor
                        Found in editor-resources/editor.js - About 7 hrs to fix

                          Function getConfig has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function getConfig()
                              {
                                  if ($this->configOverride != '') {
                                      return $this->configOverride . "\n";
                                  }
                          Severity: Minor
                          Found in lib/Weathermap/Core/MapLink.php - About 7 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 readData has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function readData($targetString, &$map, &$mapItem)
                              {
                                  $this->data[IN] = null;
                                  $this->data[OUT] = null;
                                  $pdo = weathermap_get_pdo();
                          Severity: Minor
                          Found in lib/Weathermap/Plugins/Datasources/CactiDSStats.php - About 7 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

                          Severity
                          Category
                          Status
                          Source
                          Language