howardjones/network-weathermap

View on GitHub

Showing 380 of 1,093 total issues

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

class ConfigReader
{
    private $lineCount = 0;
    /** @var MapDataItem $currentObject */
    private $currentObject = null;
Severity: Minor
Found in lib/Weathermap/Core/ConfigReader.php - About 3 hrs to fix

    Function readFromRealRRDtoolWithAggregate has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        private function readFromRealRRDtoolWithAggregate(
            $rrdfile,
            $cf,
            $aggregatefn,
            $start,
    Severity: Minor
    Found in lib/Weathermap/Plugins/Datasources/RRDTool.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

    Function parseString has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        public function parseString($input)
        {
            $output = array(); // Array of Output
            $cPhraseQuote = null; // Record of the quote that opened the current phrase
            $sPhrase = null; // Temp storage for the current phrase we are building
    Severity: Minor
    Found in lib/Weathermap/Core/ConfigReader.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 runMaps has 89 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function runMaps($mydir)
    {
        global $weathermap_debugging;
        global $weathermapPollerStartTime;
    
    
    Severity: Major
    Found in lib/Weathermap/Poller/poller-common.php - About 3 hrs to fix

      Method run has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function run()
          {
              if (!$this->preChecks()) {
                  return false;
              }
      Severity: Major
      Found in lib/Weathermap/Poller/MapRuntime.php - About 3 hrs to fix

        Method moveNode has 87 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function moveNode($nodeName, $newX, $newY)
            {
                if (!$this->isLoaded()) {
                    throw new WeathermapInternalFail("Map must be loaded before editing API called.");
                }
        Severity: Major
        Found in lib/Weathermap/Editor/Editor.php - About 3 hrs to fix

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

          function weathermap_config_settings()
          {
              global $tabs, $settings;
              $tabs["misc"] = "Misc";
          
          
          Severity: Major
          Found in lib/Weathermap/Integrations/Cacti/cacti88-plugin-hooks.php - About 3 hrs to fix

            Method readFromRealRRDtool has 86 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function readFromRealRRDtool($rrdfile, $cf, $start, $end, $dsnames, &$map, &$item)
                {
                    MapUtility::debug("RRD ReadData: traditional style\n");
            
                    // we get the last 800 seconds of data - this might be 1 or 2 lines, depending on when in the
            Severity: Major
            Found in lib/Weathermap/Plugins/Datasources/RRDTool.php - About 3 hrs to fix

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

                  public function init(&$map)
                  {
                      if ($map->context == 'cacti') {
                          $pdo = weathermap_get_pdo();
              
              
              Severity: Minor
              Found in lib/Weathermap/Plugins/Datasources/CactiTholdStatus.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

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

              <?php
              /** cacti-integrate.php
               *
               * Auto-fill a basic map file with as much information as possible from the
               * Cacti database, using interface names and node ip/names as clues.
              Severity: Minor
              Found in random-bits/cacti-integrate.php - About 3 hrs to fix

                Method generateOutlines has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function generateOutlines()
                    {
                        MapUtility::debug("Calculating angled-style outline\n");
                
                        foreach ($this->directions as $direction) {
                Severity: Major
                Found in lib/Weathermap/Core/AngledLinkGeometry.php - About 3 hrs to fix

                  Method drawArtificialIconNINK has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function drawArtificialIconNINK($iconImageRef, $finalInkColour, &$map)
                      {
                          $xRadius = $this->iconscalew / 2 - 1;
                          $yRadius = $this->iconscaleh / 2 - 1;
                          $size = $this->iconscalew;
                  Severity: Major
                  Found in lib/Weathermap/Core/MapNode.php - About 3 hrs to fix

                    Function drawMap has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function drawMap(
                            $imageFileName = '',
                            $thumbnailFileName = '',
                            $thumbnailMaxSize = 250,
                            $includeNodes = true,
                    Severity: Minor
                    Found in lib/Weathermap/Core/Map.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 drawLegendHorizontal has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function drawLegendHorizontal($keyWidth = 400)
                        {
                    
                            $title = $this->keytitle;
                    
                    
                    Severity: Major
                    Found in lib/Weathermap/Core/Legend.php - About 3 hrs to fix

                      Function dumpKeywords has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function dumpKeywords()
                          {
                              $count = 0;
                              print "# Complete configuration keyword list\n\n";
                              foreach ($this->configKeywords as $scope => $keywords) {
                      Severity: Minor
                      Found in lib/Weathermap/Core/ConfigReader.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

                      Function renameNode has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function renameNode($oldName, $newName)
                          {
                              if (!$this->map->nodeExists($oldName)) {
                                  return $oldName;
                              }
                      Severity: Minor
                      Found in lib/Weathermap/Editor/Editor.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

                      Function getAvailableImages has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getAvailableImages($imageDirectory, $map)
                          {
                              $imageList = array();
                      
                              if (is_dir($imageDirectory)) {
                      Severity: Minor
                      Found in lib/Weathermap/Editor/EditorUI.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

                      File UIBase.php has 295 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      namespace Weathermap\UI;
                      
                      use Weathermap\Core\WeathermapInternalFail;
                      Severity: Minor
                      Found in lib/Weathermap/UI/UIBase.php - About 3 hrs to fix

                        Method mapSettings has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function mapSettings(
                                $id
                            ) {
                                if ($id == 0) {
                                    $title = __('Additional settings for ALL maps');
                        Severity: Major
                        Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.php - About 3 hrs to fix

                          Method readFromRealRRDtoolWithAggregate has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function readFromRealRRDtoolWithAggregate(
                                  $rrdfile,
                                  $cf,
                                  $aggregatefn,
                                  $start,
                          Severity: Major
                          Found in lib/Weathermap/Plugins/Datasources/RRDTool.php - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language