howardjones/network-weathermap

View on GitHub

Showing 380 of 1,093 total issues

Method readFromPollerOutput has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function readFromPollerOutput($rrdfile, $cf, $start, $end, $dsnames, &$map, &$item)
    {
        global $config;

        $pdo = weathermap_get_pdo();
Severity: Major
Found in lib/Weathermap/Plugins/Datasources/RRDTool.php - About 3 hrs to fix

    Method showMainPage has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function showMainPage($editor)
        {
            global $hostPluginURL;
            global $hostEditorURL;
            global $hostType;
    Severity: Major
    Found in lib/Weathermap/Editor/EditorUI.php - About 2 hrs to fix

      Function generateOutlines has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function generateOutlines()
          {
              MapUtility::debug("Calculating angled-style outline\n");
      
              foreach ($this->directions as $direction) {
      Severity: Minor
      Found in lib/Weathermap/Core/AngledLinkGeometry.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 main has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public function main($request, $cookies, $fromPlugin = false)
          {
              $mapFileName = "";
              $action = "";
      
      
      Severity: Minor
      Found in lib/Weathermap/Editor/EditorUI.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 initializeDatabase has a Cognitive Complexity of 21 (exceeds 5 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: Minor
      Found in lib/Weathermap/Integrations/MapManager.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 drawLegendVertical has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function drawLegendVertical($keyHeight = 400, $inverted = false)
          {
              $title = $this->keytitle;
      
              $nScales = $this->scale->spanCount();
      Severity: Major
      Found in lib/Weathermap/Core/Legend.php - About 2 hrs to fix

        File Runner.php has 285 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace Weathermap\CLI;
        
        use GetOpt\GetOpt;
        Severity: Minor
        Found in lib/Weathermap/CLI/Runner.php - About 2 hrs to fix

          Method drawLabel has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function drawLabel(&$map, $textPoint, $backgroundColour, $nodeImageRef, $labelBox)
              {
                  MapUtility::debug("Label colour is $backgroundColour\n");
          
                  // if there's an icon, then you can choose to have no background
          Severity: Major
          Found in lib/Weathermap/Core/MapNode.php - About 2 hrs to fix

            Function handleInheritance has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                private function handleInheritance($inheritables, $params)
                {
                    $defaultLink = $this->map->getLink("DEFAULT");
                    $defaultNode = $this->map->getNode("DEFAULT");
            
            
            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 readData has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function readData($targetString, &$map, &$mapItem)
                {
                    $this->data[IN] = null;
                    $this->data[OUT] = null;
            
            
            Severity: Major
            Found in lib/Weathermap/Plugins/Datasources/SNMP1.php - About 2 hrs to fix

              Method readData has 68 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function readData($targetString, &$map, &$mapItem)
                  {
                      $this->data[IN] = null;
                      $this->data[OUT] = null;
              
              
              Severity: Major
              Found in lib/Weathermap/Plugins/Datasources/SNMP2c.php - About 2 hrs to fix

                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

                              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

                                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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language