howardjones/network-weathermap

View on GitHub

Showing 1,091 of 1,093 total issues

MapLink has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class MapLink extends MapDataItem
{
    const FMT_BITS_IN = '{link:this:bandwidth_in:%2k}';
    const FMT_BITS_OUT = '{link:this:bandwidth_out:%2k}';
    const FMT_UNFORM_IN = '{link:this:bandwidth_in}';
Severity: Minor
Found in lib/Weathermap/Core/MapLink.php - About 2 hrs to fix

    File cacti-mapper.php has 275 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    # defaults. Should be overwritten by the cacti config.
    $cacti_base = '../../';
    $cacti_url = '/';
    Severity: Minor
    Found in random-bits/cacti-mapper.php - About 2 hrs to fix

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

          public function __construct()
          {
              parent::__construct();
      
              $this->inheritedFieldList = array
      Severity: Major
      Found in lib/Weathermap/Core/Map.php - About 2 hrs to fix

        Method createMissingTables has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function createMissingTables($tables)
            {
                $databaseUpdates = array();
        
                if (!in_array('weathermap_maps', $tables)) {
        Severity: Major
        Found in lib/Weathermap/Integrations/MapManager.php - About 2 hrs to fix

          Method tidyOneLink has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function tidyOneLink($link, $linknumber = 1, $linktotal = 1)
              {
                  if ($link->isTemplate()) {
                      return;
                  }
          Severity: Major
          Found in lib/Weathermap/Editor/Editor.php - About 2 hrs to fix

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

                public function __construct($name, $template, $owner)
                {
                    parent::__construct();
            
                    $this->name = $name;
            Severity: Major
            Found in lib/Weathermap/Core/MapNode.php - About 2 hrs to fix

              Method testParameterValidation has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function testParameterValidation()
                  {
                      $ui = new EditorUI();
              
                      $this->assertFalse($ui->validateArgument("", 10), "Blank type is always false");
              Severity: Major
              Found in lib/Weathermap/Tests/EditorUITest.php - About 2 hrs to fix

                MapDataItem has 23 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class MapDataItem extends MapItem
                {
                    // arrays to replace a lot of what follows. Paving the way for >2 channels of data.
                    // (and generally less duplicated code)
                    public $maxValues = array();
                Severity: Minor
                Found in lib/Weathermap/Core/MapDataItem.php - About 2 hrs to fix

                  UIBase has 23 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class UIBase
                  {
                      const ARG_OPTIONAL = 2;
                      const ARG_TYPE = 1;
                      const ARG_NAME = 0;
                  Severity: Minor
                  Found in lib/Weathermap/UI/UIBase.php - About 2 hrs to fix

                    Method initializeDatabase has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function initializeDatabase()
                        {
                            // only bother with all this if it's a new install, a new version, or we're in a development version
                            // - saves a handful of db hits per request!
                    
                    
                    Severity: Major
                    Found in lib/Weathermap/Integrations/MapManager.php - About 2 hrs to fix

                      Function updateNode has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function updateNode($nodeName, $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 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 testProcessString has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function testProcessString()
                          {
                      
                              global $weathermap_debugging;
                      
                      
                      Severity: Major
                      Found in lib/Weathermap/Tests/MapTest.php - About 2 hrs to fix

                        Method permissionsList has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function permissionsList(
                                $id
                            ) {
                                $map = $this->manager->getMap($id);
                                $title = $map->titlecache;
                        Severity: Major
                        Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.php - About 2 hrs to fix

                          Method testNotes has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function testNotes()
                              {
                                  $testSuiteRoot = realpath(dirname(__FILE__) . "/../../../") . "/test-suite";
                                  
                                  $map = new Map();
                          Severity: Major
                          Found in lib/Weathermap/Tests/HTMLTest.php - About 2 hrs to fix

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

                            function weathermap_setup_table()
                            {
                                $dbversion = \read_config_option('weathermap_db_version');
                            
                                $myversioninfo = weathermap_version();
                            Severity: Major
                            Found in lib/Weathermap/Integrations/Cacti/cacti88-plugin-hooks.php and 1 other location - About 2 hrs to fix
                            lib/Weathermap/Integrations/Cacti/cacti10-plugin-hooks.php on lines 3..18

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

                            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

                            function weathermap_setup_table()
                            {
                                $dbversion = \read_config_option('weathermap_db_version');
                            
                                $myversioninfo = weathermap_version();
                            Severity: Major
                            Found in lib/Weathermap/Integrations/Cacti/cacti10-plugin-hooks.php and 1 other location - About 2 hrs to fix
                            lib/Weathermap/Integrations/Cacti/cacti88-plugin-hooks.php on lines 2..17

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

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

                                public function testLinkProperties()
                                {
                                    $editor = new Editor();
                                    $editor->newConfig();
                            
                            
                            Severity: Major
                            Found in lib/Weathermap/Tests/EditorTest.php - About 2 hrs to fix

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

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

                              Function testIndexOrphans has a Cognitive Complexity of 17 (exceeds 5 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 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 drawLabelRotated has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function drawLabelRotated($imageRef, $centre, $degreesAngle, $text, $padding, $direction)
                                  {
                                      $fontObject = $this->owner->fonts->getFont($this->bwfont);
                                      list($strWidth, $strHeight) = $fontObject->calculateImageStringSize($text);
                              
                              
                              Severity: Major
                              Found in lib/Weathermap/Core/MapLink.php - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language