howardjones/network-weathermap

View on GitHub

Showing 1,091 of 1,093 total issues

Function maplistWarnings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function maplistWarnings()
    {
        if (!MapUtility::moduleChecks()) {
            print '<div align="center" class="wm_warning"><p>';

Severity: Minor
Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.php - About 55 mins 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

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

function add_link() {
    document.getElementById('tb_help').innerText = 'Click on the first node for one end of the link.';
    document.getElementById('action').value = "add_link";
    mapmode('existing');
}
Severity: Major
Found in editor-resources/editor.js and 2 other locations - About 55 mins to fix
editor-resources/editor.js on lines 336..341
editor-resources/editor.js on lines 410..414

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

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 3 locations. Consider refactoring.
Open

function add_node() {

    document.getElementById('tb_help').innerText = 'Click on the map where you would like to add a new node.';
    document.getElementById('action').value = "add_node";
    mapmode('xy');
Severity: Major
Found in editor-resources/editor.js and 2 other locations - About 55 mins to fix
editor-resources/editor.js on lines 379..383
editor-resources/editor.js on lines 410..414

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

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 3 locations. Consider refactoring.
Open

function position_timestamp() {
    document.getElementById('tb_help').innerText = 'Click on the map where you would like to put the timestamp.';
    document.getElementById('action').value = "place_stamp";
    mapmode('xy');
}
Severity: Major
Found in editor-resources/editor.js and 2 other locations - About 55 mins to fix
editor-resources/editor.js on lines 336..341
editor-resources/editor.js on lines 379..383

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

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 readFromRealRRDtool has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    private function readFromRealRRDtool($rrdfile, $cf, $start, $end, $dsnames, &$map, &$item)
Severity: Major
Found in lib/Weathermap/Plugins/Datasources/RRDTool.php - About 50 mins to fix

    Method imageRoundedRectangle has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public static function imageRoundedRectangle($imageRef, $left, $top, $right, $bottom, $radius, $color)
    Severity: Major
    Found in lib/Weathermap/Core/ImageUtility.php - About 50 mins to fix

      Method readFromPollerOutput has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private function readFromPollerOutput($rrdfile, $cf, $start, $end, $dsnames, &$map, &$item)
      Severity: Major
      Found in lib/Weathermap/Plugins/Datasources/RRDTool.php - About 50 mins to fix

        Method imageFilledRoundedRectangle has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public static function imageFilledRoundedRectangle($imageRef, $left, $top, $right, $bottom, $radius, $color)
        Severity: Major
        Found in lib/Weathermap/Core/ImageUtility.php - About 50 mins to fix

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

          function delete_link() {
              if (confirm("This link will be deleted permanently.")) {
                  document.getElementById('action').value = "delete_link";
                  document.frmMain.submit();
              }
          Severity: Minor
          Found in editor-resources/editor.js and 1 other location - About 50 mins to fix
          editor-resources/editor.js on lines 343..348

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

          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 delete_node() {
              if (confirm("This node (and any links it is part of) will be deleted permanently.")) {
                  document.getElementById('action').value = "delete_node";
                  document.frmMain.submit();
              }
          Severity: Minor
          Found in editor-resources/editor.js and 1 other location - About 50 mins to fix
          editor-resources/editor.js on lines 385..390

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

          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

          Function getBySubstring has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getBySubstring($nameFilter, $reverseOrder = false)
              {
                  $result = array();
          
                  foreach ($this->shapes as $shape) {
          Severity: Minor
          Found in lib/Weathermap/Core/HTMLImagemap.php - About 45 mins 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 tidySimpleDimension has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              private function tidySimpleDimension($boundingBoxA, $boundingBoxB, $nodeA, $nodeB, $simpleIndex, $simpleCoordinate)
          Severity: Minor
          Found in lib/Weathermap/Editor/Editor.php - About 45 mins to fix

            Method drawImageString has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function drawImageString($gdImage, $x, $y, $string, $colour, $angle = 0)
            Severity: Minor
            Found in lib/Weathermap/Core/TrueTypeFont.php - About 45 mins to fix

              Method getSNMPData has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  private function getSNMPData($host, $params, $oids, &$item, $timeout, $retries)
              Severity: Minor
              Found in lib/Weathermap/Plugins/Datasources/SNMP3.php - About 45 mins to fix

                Function readConfigLines has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function readConfigLines($inputLines)
                    {
                        MapUtility::debug("in readConfigLines\n");
                
                        foreach ($inputLines as $buffer) {
                Severity: Minor
                Found in lib/Weathermap/Core/ConfigReader.php - About 45 mins 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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function __construct($lowValue, $highValue, $lowColour, $highColour = null, $tag = '', $label = '')
                Severity: Minor
                Found in lib/Weathermap/Core/ScaleEntry.php - About 45 mins to fix

                  Method drawImageString has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function drawImageString($gdImage, $x, $y, $string, $colour, $angle = 0)
                  Severity: Minor
                  Found in lib/Weathermap/Core/GDFont.php - About 45 mins to fix

                    Method init has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function init(&$link, $controlPoints, $widths, $directions = 2, $splitPosition = 50, $arrowStyle = 'classic')
                    Severity: Minor
                    Found in lib/Weathermap/Core/LinkGeometry.php - About 45 mins to fix

                      Function updateMapProperties has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

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

                      function show_node(name) {
                          mapmode('existing');
                      
                          hide_all_dialogs();
                      
                      
                      Severity: Minor
                      Found in editor-resources/editor.js - About 45 mins 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

                      Severity
                      Category
                      Status
                      Source
                      Language