howardjones/network-weathermap

View on GitHub

Showing 463 of 1,093 total issues

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

    public function testTidyAll()
    {
        $editor = new Editor();
        $editor->newConfig();

Severity: Minor
Found in lib/Weathermap/Tests/EditorTest.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 drawLabelRotated has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    private function drawLabelRotated($imageRef, $centre, $degreesAngle, $text, $padding, $direction)
Severity: Minor
Found in lib/Weathermap/Core/MapLink.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

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

          initKeys: function (that) {
              $(document).keyup(function (event) {
                  if (event.keyCode === that.KEYCODE_ESCAPE) {
                      window.location.href = $('#cycle_stop').attr('href');
                      event.preventDefault();
      Severity: Minor
      Found in cacti-resources/map-cycle.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

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

              $imageFileName = '',
              $thumbnailFileName = '',
              $thumbnailMaxSize = 250,
              $includeNodes = true,
              $showVIAOverlay = false,
      Severity: Minor
      Found in lib/Weathermap/Core/Map.php - About 45 mins to fix

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

          render() {
        
            let contents = null;
        
            if (this.state.loaded) {
        Severity: Minor
        Found in websrc/cacti-mgmt/src/components/AddMap.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

        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

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

              protected function getConfigInOutOrBoth($comparison, $configKeyword, $fieldName)
              {
                  $output = '';
                  $myArray = $this->$fieldName;
                  $theirArray = $comparison->$fieldName;
          Severity: Minor
          Found in lib/Weathermap/Core/MapDataItem.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

            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

            Avoid deeply nested control flow statements.
            Open

                                    if ($size[0] > $this->minBGImageSize && $size[1] > $this->minBGImageSize) {
                                        $bg = true;
                                    }
            Severity: Major
            Found in lib/Weathermap/Editor/EditorUI.php - About 45 mins to fix

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

                  public function mapReadOnlySettings(
                      $id,
                      $title = ''
                  ) {
                      if ($title == '') {
              Severity: Minor
              Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.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 weathermap_show_tab has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function weathermap_show_tab()
              {
                  global $config, $user_auth_realm_filenames;
                  $realmID = 0;
              
              
              Severity: Minor
              Found in lib/Weathermap/Integrations/Cacti/cacti88-plugin-hooks.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 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

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

                        Function drawViaOverlay has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function drawViaOverlay($imageRef, $overlayColor)
                            {
                                foreach ($this->links as $link) {
                                    foreach ($link->viaList as $via) {
                                        if (isset($via[2])) {
                        Severity: Minor
                        Found in lib/Weathermap/Core/Map.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