howardjones/network-weathermap

View on GitHub

Showing 463 of 1,093 total issues

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

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

    Function generateSortedImagemap has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        public function generateSortedImagemap($imagemapname)
        {
            $html = "\n<map name=\"" . $imagemapname . '" id="' . $imagemapname . "\">\n";
    
            $allLayers = array_keys($this->seenZLayers);
    Severity: Minor
    Found in lib/Weathermap/Core/Map.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 getConfig has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getConfig()
        {
            $output = '';
    
            $output .= "# Automatically generated by php-weathermap v" . WEATHERMAP_VERSION . "\n\n";
    Severity: Minor
    Found in lib/Weathermap/Core/Map.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

    WeatherMapCactiUserPlugin has 35 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class WeatherMapCactiUserPlugin extends UIBase
    {
        /** @var MapManager $manager */
        public $manager;
        public $myURL;
    Severity: Minor
    Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php - About 4 hrs to fix

      MapNode has 34 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class MapNode extends MapDataItem
      {
          public $drawable;
      
          // Coordinates we're actually going to draw at
      Severity: Minor
      Found in lib/Weathermap/Core/MapNode.php - About 4 hrs to fix

        Method getConfig has 107 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getConfig()
            {
                if ($this->configOverride != '') {
                    return $this->configOverride . "\n";
                }
        Severity: Major
        Found in lib/Weathermap/Core/MapNode.php - About 4 hrs to fix

          File MapDataItem.php has 341 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace Weathermap\Core;
          
          /**
          Severity: Minor
          Found in lib/Weathermap/Core/MapDataItem.php - About 4 hrs to fix

            File check.php has 340 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            $criticalCount = 0;
            $nonCriticalCount = 0;
            
            // This constant was added in PHP 5.2 - since we're actually checking that the version is > 5.3, it might
            Severity: Minor
            Found in check.php - About 4 hrs to fix

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

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

                Function init has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function init(&$map)
                    {
                        if ($map->context == 'cacti') {
                            if (!function_exists('db_fetch_assoc')) {
                                MapUtility::debug("ReadData DSStats: Cacti database library not found. [DSSTATS001]\n");
                Severity: Minor
                Found in lib/Weathermap/Plugins/Datasources/CactiDSStats.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 drawLegendClassic has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function drawLegendClassic($useTags = false)
                    {
                        $nScales = $this->scale->spanCount();
                
                        MapUtility::debug("Drawing $nScales colours into SCALE\n");
                Severity: Minor
                Found in lib/Weathermap/Core/Legend.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 weathermap_poller_output has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function weathermap_poller_output($rrdUpdateArray)
                {
                    global $config;
                
                    $pdo = weathermap_get_pdo();
                Severity: Major
                Found in lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php - About 4 hrs to fix

                  Method weathermap_config_settings has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function weathermap_config_settings()
                  {
                      global $tabs, $settings;
                  
                      $tabs['weathermap'] = __('Maps', 'weathermap');
                  Severity: Major
                  Found in lib/Weathermap/Integrations/Cacti/cacti10-plugin-hooks.php - About 4 hrs to fix

                    Method addmapPicker has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function addmapPicker(
                            $showAllFiles = false
                        ) {
                            $loaded = array();
                            $flags = array();
                    Severity: Major
                    Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.php - About 3 hrs to fix

                      Function runMaps has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function runMaps($mydir)
                      {
                          global $weathermap_debugging;
                          global $weathermapPollerStartTime;
                      
                      
                      Severity: Minor
                      Found in lib/Weathermap/Poller/poller-common.php - About 3 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 96 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Method drawLegendClassic has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function drawLegendClassic($useTags = false)
                            {
                                $nScales = $this->scale->spanCount();
                        
                                MapUtility::debug("Drawing $nScales colours into SCALE\n");
                        Severity: Major
                        Found in lib/Weathermap/Core/Legend.php - About 3 hrs to fix

                          Function imagecreatefromfile has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function imagecreatefromfile($filename)
                              {
                                  $resultImage = null;
                                  $newImage = null;
                          
                          
                          Severity: Minor
                          Found in lib/Weathermap/Core/ImageLoader.php - About 3 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 getConfig has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getConfig()
                              {
                                  $output = '';
                          
                                  $output .= "# Automatically generated by php-weathermap v" . WEATHERMAP_VERSION . "\n\n";
                          Severity: Major
                          Found in lib/Weathermap/Core/Map.php - About 3 hrs to fix

                            MapManagerTest has 30 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class MapManagerTest extends \PHPUnit_Extensions_Database_TestCase
                            {
                            
                                // only instantiate pdo once for test clean-up/fixture load
                                static private $pdo = null;
                            Severity: Minor
                            Found in lib/Weathermap/Tests/MapManagerTest.php - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language