howardjones/network-weathermap

View on GitHub

Showing 380 of 1,093 total issues

Method handleManagementMainScreen has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handleManagementMainScreen($request, $appObject)
    {
        global $wm_showOldUI, $config;

        $weathermapPath = $config['url_path'] . 'plugins/weathermap/';

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

      Method drawArtificialIconPie has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function drawArtificialIconPie($iconImageRef, $finalFillColour, $finalInkColour, $channel)
          {
              $percentValue = $this->percentUsages[$channel];
      
              $segmentAngle = MathUtility::clip(($percentValue / 100) * 360, 1, 360);
      Severity: Minor
      Found in lib/Weathermap/Core/MapNode.php - About 1 hr to fix

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

          Method testNodeProperties has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function testNodeProperties()
              {
                  $editor = new Editor();
                  $editor->newConfig();
          
          
          Severity: Minor
          Found in lib/Weathermap/Tests/EditorTest.php - About 1 hr to fix

            Method createThumbnailFile has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function createThumbnailFile($thumbnailFileName, $thumbnailMaxSize, $imageRef)
                {
                    MapUtility::debug("Writing thumbnail to $thumbnailFileName\n");
            
                    if (!function_exists('imagecopyresampled')) {
            Severity: Minor
            Found in lib/Weathermap/Core/Map.php - About 1 hr to fix

              Method handleDefaultView has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function handleDefaultView($request, $appObject)
                  {
                      global $wm_showOldUI, $config;
              
                      $weathermapPath = $config['url_path'] . 'plugins/weathermap/';
              Severity: Minor
              Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php - About 1 hr to fix

                Function click_handler has a Cognitive Complexity of 12 (exceeds 5 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

                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 deleteNode has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function deleteNode($nodeName)
                    {
                        if (!$this->isLoaded()) {
                            throw new WeathermapInternalFail("Map must be loaded before editing API called.");
                        }
                Severity: Minor
                Found in lib/Weathermap/Editor/Editor.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 readDataFromFile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function readDataFromFile($targetstring, $matchvalue, $matchperiod)
                    {
                        $fd = fopen($targetstring, "r");
                
                        if ($fd) {
                Severity: Minor
                Found in lib/Weathermap/Plugins/Datasources/Mrtg.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 mapSettings has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function mapSettings(
                        $id
                    ) {
                        if ($id == 0) {
                            $title = __('Additional settings for ALL maps');

                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 permissionsList has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function permissionsList(
                        $id
                    ) {
                        $map = $this->manager->getMap($id);
                        $title = $map->titlecache;

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

                    public function __construct()
                    {
                        $this->alpha = 255;
                
                        // a set of 3 colours
                Severity: Minor
                Found in lib/Weathermap/Core/Colour.php - About 1 hr to fix

                  Method getMapFileList has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function getMapFileList()
                      {
                          $files = array();
                          $valid_files = array();
                  
                  

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

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

                          public function getConfig()
                          {
                              assert(isset($this->owner));
                      
                              $output = '';
                      Severity: Minor
                      Found in lib/Weathermap/Core/Legend.php - About 1 hr to fix

                        Function render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            render() {
                        
                                let higher = <div/>
                        
                                if (this.props.scope === 'map') {
                        Severity: Minor
                        Found in websrc/cacti-mgmt/src/components/SetEditor.js - About 1 hr to fix

                          Method outputHTML has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function outputHTML()
                              {
                                  if ($this->htmlFile != '') {
                                      MapUtility::debug("Writing HTML to $this->htmlFile\n");
                          
                          
                          Severity: Minor
                          Found in lib/Weathermap/CLI/Runner.php - About 1 hr to fix

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

                              Method testMapSettings has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function testMapSettings()
                                  {
                              
                                      $settings = $this->manager->getMapSettings(0);
                                      $this->assertEquals(1, count($settings));
                              Severity: Minor
                              Found in lib/Weathermap/Tests/MapManagerTest.php - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language