howardjones/network-weathermap

View on GitHub

Showing 1,091 of 1,093 total issues

Method interpretNodeSpec has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function interpretNodeSpec($input)
    {
        $endOffset = 'C';
        $nodeName = $input;
        $xOffset = 0;
Severity: Minor
Found in lib/Weathermap/Core/ConfigReader.php - About 1 hr to fix

    Method updateNode has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function updateNode($nodeName, $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 1 hr to fix

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

        Method readData has 41 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/CactiHostStatus.php - About 1 hr to fix

          Method handleNODES has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function handleNODES($fullcommand, $args, $matches)
              {
                  $offsetDX = array();
                  $offsetDY = array();
                  $nodeNames = array();
          Severity: Minor
          Found in lib/Weathermap/Core/ConfigReader.php - About 1 hr to fix

            Method colourFromValue has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function colourFromValue($value, $itemName = '', $isPercentage = true, $showScaleWarnings = true)
                {
                    $scaleName = $this->name;
            
                    MapUtility::debug("Finding a colour for value %s in scale %s\n", $value, $this->name);
            Severity: Minor
            Found in lib/Weathermap/Core/MapScale.php - About 1 hr to fix

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

                Function validateRequest has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function validateRequest($action, $request)
                    {
                        if (!array_key_exists($action, $this->commands)) {
                            error_log("Given action does not exist!");
                            return false;
                Severity: Minor
                Found in lib/Weathermap/UI/UIBase.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 drawRealIcon has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function drawRealIcon(&$map, $iconColour)
                    {
                        $this->iconfile = $map->processString($this->iconfile, $this);
                
                        MapUtility::debug('Actual image-based icon from ' . $this->iconfile . " for $this->name\n");
                Severity: Minor
                Found in lib/Weathermap/Core/MapNode.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 colourFromValue has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function colourFromValue($value, $itemName = '', $isPercentage = true, $showScaleWarnings = true)
                    {
                        $scaleName = $this->name;
                
                        MapUtility::debug("Finding a colour for value %s in scale %s\n", $value, $this->name);
                Severity: Minor
                Found in lib/Weathermap/Core/MapScale.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 getSNMPData has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function getSNMPData($host, $params, $oids, &$item, $timeout, $retries)
                    {
                        $channels = array(
                            'in' => IN,
                            'out' => OUT
                Severity: Minor
                Found in lib/Weathermap/Plugins/Datasources/SNMP3.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 ReadData has a Cognitive Complexity of 13 (exceeds 5 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

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

                    public function testPoint()
                    {
                        $point1 = new Point(10, 13);
                        $point2 = new Point(-40, 40);
                        $point3 = new Point(30, 33);
                Severity: Minor
                Found in lib/Weathermap/Tests/GeometryTest.php - About 1 hr to fix

                  Method runOutputTest has 39 lines of code (exceeds 25 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

                    Method getSNMPData has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function getSNMPData($host, $params, $oids, &$item, $timeout, $retries)
                        {
                            $channels = array(
                                'in' => IN,
                                'out' => OUT
                    Severity: Minor
                    Found in lib/Weathermap/Plugins/Datasources/SNMP3.php - About 1 hr to fix

                      Method outputMapViewHeader has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function outputMapViewHeader($pageTitle, $isCycling, $limitingToGroup)
                          {
                              \html_start_box($pageTitle, '100%', '', '3', 'center', '');
                              ?>
                              <tr class="even">
                      Severity: Minor
                      Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php - About 1 hr to fix

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

                            this.css("left", Math.max(0, (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft()) + "px");
                        Severity: Major
                        Found in cacti-resources/map-cycle.js and 1 other location - About 1 hr to fix
                        cacti-resources/map-cycle.js on lines 8..8

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

                        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.css("top", Math.max(0, (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop()) + "px");
                        Severity: Major
                        Found in cacti-resources/map-cycle.js and 1 other location - About 1 hr to fix
                        cacti-resources/map-cycle.js on lines 9..9

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

                        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

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

                                To group: <Selector id="groupselector"
                                                    options={Object.values(this.props.groups)}
                                                    value={this.state.selectedGroup}
                                                    defaultOption="select Group"
                                                    callbackFn={this.updateSelectedGroup}/>
                        Severity: Major
                        Found in websrc/cacti-mgmt/src/components/AddMap.js and 1 other location - About 1 hr to fix
                        websrc/cacti-mgmt/src/components/CreateMap.js on lines 43..47

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

                        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

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

                              <p>Group name: <Selector id="groupselector"
                                                       options={Object.values(this.props.groups)}
                                                       value={this.state.selectedGroup}
                                                       defaultOption="select Group"
                                                       callbackFn={this.updateSelectedGroup}/>
                        Severity: Major
                        Found in websrc/cacti-mgmt/src/components/CreateMap.js and 1 other location - About 1 hr to fix
                        websrc/cacti-mgmt/src/components/AddMap.js on lines 137..141

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language