howardjones/network-weathermap

View on GitHub

Showing 380 of 1,093 total issues

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

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

                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

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

                          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
                                Severity
                                Category
                                Status
                                Source
                                Language