howardjones/network-weathermap

View on GitHub

Showing 1,091 of 1,093 total issues

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

    public function handleNodeStep1($request, $context = null)
    {
        global $config; // Cacti config object

        $hostId = -1;
Severity: Minor
Found in lib/Weathermap/Integrations/Cacti/EditorDataPicker.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

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

        if (event.target.value === 'on') {
            this.props.enableMap(this.props.match.params.id);
        }
Severity: Minor
Found in websrc/cacti-mgmt/src/components/MapProperties.js and 1 other location - About 45 mins to fix
websrc/cacti-mgmt/src/components/MapProperties.js on lines 39..41

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

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

            map: this.props.maps.filter(map => map.id === this.props.match.params.id).map((map => map))[0]
Severity: Minor
Found in websrc/cacti-mgmt/src/components/MapProperties.js and 1 other location - About 45 mins to fix
websrc/cacti-user/src/components/SingleMap.js on lines 37..41

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

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

        this.props.maps.filter(map => map.filehash === this.props.match.params.map_id).map(map => {
          return this.setState({
            selectedMap: map
          },);
        });
Severity: Minor
Found in websrc/cacti-user/src/components/SingleMap.js and 1 other location - About 45 mins to fix
websrc/cacti-mgmt/src/components/MapProperties.js on lines 17..17

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

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 (event.target.value === 'off') {
            this.props.disableMap(this.props.match.params.id);
        }
Severity: Minor
Found in websrc/cacti-mgmt/src/components/MapProperties.js and 1 other location - About 45 mins to fix
websrc/cacti-mgmt/src/components/MapProperties.js on lines 36..38

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

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

    public function extractSettingsCookie($cookies)
    {
        // these are all set via the Editor Settings dialog, in the editor, now.

        $this->useOverlayVIA = false; // set to TRUE to enable experimental overlay showing VIAs
Severity: Minor
Found in lib/Weathermap/Editor/EditorUI.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

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

        MapUtility::debug("RRD ReadDataFromRealRRD: Returning (" . ($this->data[IN] === null ? 'null' : $this->data[IN]) . "," . ($this->data[OUT] === null ? 'null' : $this->data[OUT]) . ",$this->dataTime)\n");
Severity: Minor
Found in lib/Weathermap/Plugins/Datasources/RRDTool.php and 1 other location - About 40 mins to fix
lib/Weathermap/Plugins/Datasources/RRDTool.php on lines 307..307

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

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

        MapUtility::debug("RRD ReadDataFromRealRRDAggregate: Returning (" . ($this->data[IN] === null ? 'null' : $this->data[IN]) . "," . ($this->data[OUT] === null ? 'null' : $this->data[OUT]) . ",$this->dataTime)\n");
Severity: Minor
Found in lib/Weathermap/Plugins/Datasources/RRDTool.php and 1 other location - About 40 mins to fix
lib/Weathermap/Plugins/Datasources/RRDTool.php on lines 432..432

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

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 (($bwInOld != $bwIn) || ($bwOutOld != $bwOut)) {
            $defaultLink->maxValuesConfigured[IN] = $bwIn;
            $defaultLink->maxValuesConfigured[OUT] = $bwOut;
            $defaultLink->maxValues[IN] = StringUtility::interpretNumberWithMetricSuffix($bwIn, $this->map->kilo);
            $defaultLink->maxValues[OUT] = StringUtility::interpretNumberWithMetricSuffix($bwOut, $this->map->kilo);
Severity: Minor
Found in lib/Weathermap/Editor/Editor.php and 1 other location - About 40 mins to fix
lib/Weathermap/Editor/Editor.php on lines 1136..1141

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

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 (($link->maxValuesConfigured[IN] == $bwInOld) || ($link->maxValuesConfigured[OUT] == $bwOutOld)) {
                $link->maxValuesConfigured[IN] = $bwIn;
                $link->maxValuesConfigured[OUT] = $bwOut;
                $link->maxValues[IN] = StringUtility::interpretNumberWithMetricSuffix($bwIn, $this->map->kilo);
                $link->maxValues[OUT] = StringUtility::interpretNumberWithMetricSuffix($bwOut, $this->map->kilo);
Severity: Minor
Found in lib/Weathermap/Editor/Editor.php and 1 other location - About 40 mins to fix
lib/Weathermap/Editor/Editor.php on lines 1128..1133

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

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

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

    Method drawMarkerPolygon has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public static function drawMarkerPolygon($gdImage, $colour, $point, $size, $relativeMoves)
    Severity: Minor
    Found in lib/Weathermap/Core/ImageUtility.php - About 35 mins to fix

      Method drawLabel has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private function drawLabel(&$map, $textPoint, $backgroundColour, $nodeImageRef, $labelBox)
      Severity: Minor
      Found in lib/Weathermap/Core/MapNode.php - About 35 mins to fix

        Method imagecreatescaledcolourizedfromfile has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function imagecreatescaledcolourizedfromfile($filename, $scaleWidth, $scaleHeight, $colour, $colourMethod)
        Severity: Minor
        Found in lib/Weathermap/Core/ImageLoader.php - About 35 mins to fix

          Method buildOverlibPositioning has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              private function buildOverlibPositioning($mapItem, $midX, $mapCenterX, $midY, $mapCenterY)
          Severity: Minor
          Found in lib/Weathermap/Core/Map.php - About 35 mins to fix

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

            function manage_images() {
                mapmode('existing');
            
                hide_all_dialogs();
                document.getElementById('action').value = "set_image";
            Severity: Minor
            Found in editor-resources/editor.js and 1 other location - About 35 mins to fix
            editor-resources/editor.js on lines 296..302

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

            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 manage_colours() {
                mapmode('existing');
            
                hide_all_dialogs();
                document.getElementById('action').value = "set_map_colours";
            Severity: Minor
            Found in editor-resources/editor.js and 1 other location - About 35 mins to fix
            editor-resources/editor.js on lines 304..310

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

            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 edit_link() {
                document.getElementById('action').value = "edit_link";
                show_itemtext('link', document.frmMain.link_name.value);
            }
            Severity: Minor
            Found in editor-resources/editor.js and 1 other location - About 35 mins to fix
            editor-resources/editor.js on lines 355..358

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

            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 edit_node() {
                document.getElementById('action').value = "edit_node";
                show_itemtext('node', document.frmMain.node_name.value);
            }
            Severity: Minor
            Found in editor-resources/editor.js and 1 other location - About 35 mins to fix
            editor-resources/editor.js on lines 360..363

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

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

                private function copyParamsFromCacti($profileName, $hostId)
                {
                    $params = array();
            
                    foreach ($this->snmpParamDefaults as $keyname => $default) {
            Severity: Minor
            Found in lib/Weathermap/Plugins/Datasources/SNMP3.php - About 35 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