howardjones/network-weathermap

View on GitHub

Showing 1,091 of 1,093 total issues

Function attach_click_events has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function attach_click_events() {

    jQuery("area[id^='LINK:']").attr("href", "#").click(click_handler);
    jQuery("area[id^='NODE:']").attr("href", "#").click(click_handler);
    jQuery("area[id^='TIMES']").attr("href", "#").click(position_timestamp);
Severity: Minor
Found in editor-resources/editor.js - About 1 hr to fix

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

        public function editorData()
        {
            $newOutput = array(
                "id" => "L" . $this->id,
                "name" => $this->name,
    Severity: Minor
    Found in lib/Weathermap/Core/MapLink.php - About 1 hr to fix

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

        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/';

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          function map_properties() {
              mapmode('existing');
          
              hide_all_dialogs();
              document.getElementById('action').value = "set_map_properties";
          Severity: Major
          Found in editor-resources/editor.js and 1 other location - About 1 hr to fix
          editor-resources/editor.js on lines 401..408

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 65.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          function map_style() {
              mapmode('existing');
          
              hide_all_dialogs();
              document.getElementById('action').value = "set_map_style";
          Severity: Major
          Found in editor-resources/editor.js and 1 other location - About 1 hr to fix
          editor-resources/editor.js on lines 392..399

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 65.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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 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 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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    if (props.settings.page_style === 'thumbs') {
                      maps = my_maps.map((item, index) => {
                        return (<MapThumbnail map={item} key={index}/>)
                      });
                    }
                Severity: Major
                Found in websrc/cacti-user/src/components/MapCollection.js and 1 other location - About 1 hr to fix
                websrc/cacti-user/src/components/MapCollection.js on lines 24..28

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 64.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    if (props.settings.page_style === 'full') {
                      maps = my_maps.map((item, index) => {
                        return (<MapFull map={item} key={index}/>)
                      });
                    }
                Severity: Major
                Found in websrc/cacti-user/src/components/MapCollection.js and 1 other location - About 1 hr to fix
                websrc/cacti-user/src/components/MapCollection.js on lines 18..22

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 64.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                export default function (state = INITIAL_STATE, action) {
                
                    switch (action.type) {
                        case GET_MAPS_SUCCESS:
                            state = action.data.groups;
                Severity: Major
                Found in websrc/cacti-mgmt/src/reducers/GroupsReducer.js and 1 other location - About 1 hr to fix
                websrc/cacti-mgmt/src/reducers/MapsReducer.js on lines 5..24

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 64.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                export default function (state = INITIAL_STATE, action) {
                
                    switch (action.type) {
                        case GET_MAPS_SUCCESS:
                            state = action.data.maps;
                Severity: Major
                Found in websrc/cacti-mgmt/src/reducers/MapsReducer.js and 1 other location - About 1 hr to fix
                websrc/cacti-mgmt/src/reducers/GroupsReducer.js on lines 5..25

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 64.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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 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 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 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

                      Severity
                      Category
                      Status
                      Source
                      Language