howardjones/network-weathermap

View on GitHub

Showing 380 of 1,093 total issues

Method initializeDatabase has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function initializeDatabase()
    {
        // only bother with all this if it's a new install, a new version, or we're in a development version
        // - saves a handful of db hits per request!

Severity: Major
Found in lib/Weathermap/Integrations/MapManager.php - About 2 hrs to fix

    Function updateNode has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs 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 testProcessString has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function testProcessString()
        {
    
            global $weathermap_debugging;
    
    
    Severity: Major
    Found in lib/Weathermap/Tests/MapTest.php - About 2 hrs to fix

      Method permissionsList has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function permissionsList(
              $id
          ) {
              $map = $this->manager->getMap($id);
              $title = $map->titlecache;
      Severity: Major
      Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.php - About 2 hrs to fix

        Method testNotes has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function testNotes()
            {
                $testSuiteRoot = realpath(dirname(__FILE__) . "/../../../") . "/test-suite";
                
                $map = new Map();
        Severity: Major
        Found in lib/Weathermap/Tests/HTMLTest.php - About 2 hrs to fix

          Method testLinkProperties has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function testLinkProperties()
              {
                  $editor = new Editor();
                  $editor->newConfig();
          
          
          Severity: Major
          Found in lib/Weathermap/Tests/EditorTest.php - About 2 hrs to fix

            Function testIndexOrphans has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                public function testIndexOrphans()
                {
                    # Check that all the little config XML files actually appear somewhere in the index.xml
                    $docsIndex = $this->docsRoot . "/index.xml";
            
            
            Severity: Minor
            Found in lib/Weathermap/Tests/DocsTest.php - About 2 hrs 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 17 (exceeds 5 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/WeathermapData.php - About 2 hrs 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 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function drawLabelRotated($imageRef, $centre, $degreesAngle, $text, $padding, $direction)
                {
                    $fontObject = $this->owner->fonts->getFont($this->bwfont);
                    list($strWidth, $strHeight) = $fontObject->calculateImageStringSize($text);
            
            
            Severity: Major
            Found in lib/Weathermap/Core/MapLink.php - About 2 hrs to fix

              Method imagecreatefromfile has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function imagecreatefromfile($filename)
                  {
                      $resultImage = null;
                      $newImage = null;
              
              
              Severity: Major
              Found in lib/Weathermap/Core/ImageLoader.php - About 2 hrs to fix

                Method handleGroupSelect has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function handleGroupSelect(
                        $request,
                        $appObject
                    ) {
                        $this->cactiHeader();
                Severity: Major
                Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.php - About 2 hrs to fix

                  Method handleMapGroupChangeForm has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function handleMapGroupChangeForm(
                          $request,
                          $appObject
                      ) {
                          $this->cactiHeader();
                  Severity: Major
                  Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.php - About 2 hrs to fix

                    Method testConfigOutput has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function testConfigOutput($configFileName, $referenceImageFileName)
                        {
                            $outputImageFileName = self::$result1Directory . DIRECTORY_SEPARATOR . $configFileName . ".png";
                            $comparisonImageFileName = self::$diffsDirectory . DIRECTORY_SEPARATOR . $configFileName . ".png";
                            $outputHTMLFileName = self::$result1Directory . DIRECTORY_SEPARATOR . $configFileName . ".html";
                    Severity: Major
                    Found in lib/Weathermap/Tests/ConfigTest.php - About 2 hrs to fix

                      Function render has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        render() {
                      
                          let contents = null;
                      
                          if (this.state.loaded) {
                      Severity: Major
                      Found in websrc/cacti-mgmt/src/components/AddMap.js - About 2 hrs to fix

                        Method configlist has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function configlist()
                            {
                                self::checkPaths();
                        
                                $summaryFileName = self::$testSuiteDirectory . DIRECTORY_SEPARATOR . "summary.html";
                        Severity: Major
                        Found in lib/Weathermap/Tests/ConfigTest.php - About 2 hrs to fix

                          Function handleNODES has a Cognitive Complexity of 16 (exceeds 5 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 2 hrs 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 testCronPart has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function testCronPart($value, $checkstring)
                              {
                                  if ($checkstring == '*') {
                                      return true;
                                  }
                          Severity: Minor
                          Found in lib/Weathermap/Core/Utility.php - About 2 hrs 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 calculateAICONColours has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function calculateAICONColours($labelColour, &$map)
                              {
                                  $finalFillColour = new Colour('none');
                                  $finalInkColour = new Colour('none');
                          
                          
                          Severity: Minor
                          Found in lib/Weathermap/Core/MapNode.php - About 2 hrs 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 compareImages has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function compareImages($src, $copy, $type)
                              {
                                  $this->assertEquals(imagesx($src), imagesx($copy));
                                  $this->assertEquals(imagesy($src), imagesy($copy));
                                  $this->assertEquals(imageistruecolor($src), imageistruecolor($copy));
                          Severity: Minor
                          Found in lib/Weathermap/Tests/ImageLoaderTest.php - About 2 hrs 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 getMapFileList has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function getMapFileList()
                              {
                                  $files = array();
                                  $valid_files = array();
                          
                          
                          Severity: Minor
                          Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.php - About 2 hrs 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