howardjones/network-weathermap

View on GitHub

Showing 380 of 1,093 total issues

Function runOutputTest has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function runOutputTest($iconFileName, $imageFileName, $htmlFileName, $newConfigFileName)
    {
        $map = new Map();

        $map->readConfig($iconFileName);
Severity: Minor
Found in lib/Weathermap/Tests/TestSupport.php - About 1 hr 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 findIndexNearDistance has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function findIndexNearDistance($targetDistance)
    {
        $left = 0;
        $right = count($this->elements) - 1;

Severity: Minor
Found in lib/Weathermap/Core/Spine.php - About 1 hr 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 weathermap_poller_bottom has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function weathermap_poller_bottom()
{
    global $config;
    global $weathermapPollerStartTime;

Severity: Minor
Found in lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php - About 1 hr 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 testTidyAll has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testTidyAll()
    {
        $editor = new Editor();
        $editor->newConfig();

Severity: Minor
Found in lib/Weathermap/Tests/EditorTest.php - About 1 hr to fix

    Function show_node has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function show_node(name) {
        mapmode('existing');
    
        hide_all_dialogs();
    
    
    Severity: Minor
    Found in editor-resources/editor.js - About 1 hr to fix

      Function click_handler has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function click_handler(e) {
          var alt, objectname, objecttype, objectid, map_object;
      
          alt = jQuery(this).attr("id");
      
      
      Severity: Minor
      Found in editor-resources/editor.js - About 1 hr to fix

        Method processStringToken has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function processStringToken($includeNotes, $keyContents, $key, $context)
            {
                $value = '[UNKNOWN]';
                $format = "";
                $theItem = null;
        Severity: Minor
        Found in lib/Weathermap/Core/Map.php - About 1 hr to fix

          Method handleLinkStep1 has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function handleLinkStep1($request, $context = null)
              {
                  global $config;
          
          //        $pdo = weathermap_get_pdo();
          Severity: Minor
          Found in lib/Weathermap/Integrations/Cacti/EditorDataPicker.php - About 1 hr to fix

            Method getAvailableImages has 31 lines of code (exceeds 25 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 1 hr to fix

              Method getExistingConfigs has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getExistingConfigs($mapDirectory)
                  {
                      $titles = array();
                      $notes = array();
              
              
              Severity: Minor
              Found in lib/Weathermap/Editor/EditorUI.php - About 1 hr to fix

                Method weathermap_show_tab has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function weathermap_show_tab()
                {
                    global $config, $user_auth_realm_filenames;
                    $realmID = 0;
                
                
                Severity: Minor
                Found in lib/Weathermap/Integrations/Cacti/cacti88-plugin-hooks.php - About 1 hr to fix

                  Method handleSCALE has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function handleSCALE($fullcommand, $args, $matches)
                      {
                  
                          // The default scale name is DEFAULT
                          if ($matches[1] == '') {
                  Severity: Minor
                  Found in lib/Weathermap/Core/ConfigReader.php - About 1 hr to fix

                    Method ReadData has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function ReadData($targetString, &$map, &$mapItem)
                        {
                            // By default, fail.
                            // Remove these 4 lines ONLY if you understand the risks, and have taken appropriate measures
                            // so that users (or the public) can't access your map editor! Otherwise they can run
                    Severity: Minor
                    Found in lib/Weathermap/Plugins/Datasources/ExternalScript.php - About 1 hr to fix

                      Method compareImages has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function compareImages($src, $copy, $type)
                          {
                              $this->assertEquals(imagesx($src), imagesx($copy));
                              $this->assertEquals(imagesy($src), imagesy($copy));
                              $this->assertEquals(imageistruecolor($src), imageistruecolor($copy));
                      Severity: Minor
                      Found in lib/Weathermap/Tests/ImageLoaderTest.php - About 1 hr to fix

                        Method has_transparency has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function has_transparency($imageRef)
                        {
                            $width = imagesx($imageRef);
                            $height = imagesy($imageRef);
                            $im2 = imagecreate($width, $height);
                        Severity: Minor
                        Found in test-multipass.php - About 1 hr to fix

                          Method testKeywordCoverage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function testKeywordCoverage()
                              {
                          
                                  $docsIndex = $this->docsRoot . "/index.xml";
                          
                          
                          Severity: Minor
                          Found in lib/Weathermap/Tests/DocsTest.php - About 1 hr to fix

                            Method handleMapSettingsSave has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function handleMapSettingsSave(
                                    $request,
                                    $appObject
                                ) {
                                    $mapid = null;

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

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

                                Method createColorizePalette has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public static function createColorizePalette($red, $green, $blue)
                                    {
                                        // We will create a monochromatic palette based on the input color
                                        // which will go from black to white
                                
                                
                                Severity: Minor
                                Found in lib/Weathermap/Core/ImageUtility.php - About 1 hr to fix

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

                                      public function readData(&$map, &$mapItem)
                                      {
                                          MapUtility::debug("ReadData for $mapItem ($this->pluginName $this->pluginRunnable)\n");
                                          if (!$this->pluginRunnable) {
                                              MapUtility::debug("Plugin %s isn't runnable\n", $this->pluginName);
                                  Severity: Minor
                                  Found in lib/Weathermap/Core/Target.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language