howardjones/network-weathermap

View on GitHub

Showing 380 of 1,093 total issues

Function handleGroupSelect has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function handleGroupSelect(
        $request,
        $appObject
    ) {
        $this->cactiHeader();
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

Method calculateImagemap has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function calculateImagemap()
    {
        MapUtility::debug("Trace: calculateImagemap()\n");

        // loop through everything. Figure out along the way if it's a node or a link
Severity: Minor
Found in lib/Weathermap/Core/Map.php - About 1 hr to fix

    Method __construct has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct($name, $template, $owner)
        {
            parent::__construct();
    
            $this->name = $name;
    Severity: Minor
    Found in lib/Weathermap/Core/MapLink.php - About 1 hr to fix

      Method ping has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function ping(&$item, $targetAddress, $pingCount)
          {
              if (!is_executable($this->fpingCommand)) {
                  MapUtility::warn("FPing ReadData: Can't find fping executable. Check path at line 36 of FPing");
                  return;
      Severity: Minor
      Found in lib/Weathermap/Plugins/Datasources/FPing.php - About 1 hr to fix

        Method preCalculate has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function preCalculate(&$map)
            {
                MapUtility::debug('Link ' . $this->name . ": Calculating geometry.\n");
        
                // don't bother doing anything if it's a template
        Severity: Minor
        Found in lib/Weathermap/Core/MapLink.php - About 1 hr to fix

          Method drawMap has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function drawMap(
                  $imageFileName = '',
                  $thumbnailFileName = '',
                  $thumbnailMaxSize = 250,
                  $includeNodes = true,
          Severity: Minor
          Found in lib/Weathermap/Core/Map.php - About 1 hr to fix

            Method debug has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function debug($string)
                {
                    global $weathermap_debugging;
                    global $weathermap_map;
                    global $weathermap_debug_suppress;
            Severity: Minor
            Found in lib/Weathermap/Core/MapUtility.php - About 1 hr to fix

              Method maplistWarnings has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function maplistWarnings()
                  {
                      if (!MapUtility::moduleChecks()) {
                          print '<div align="center" class="wm_warning"><p>';
              
              

                Function selfValidate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function selfValidate()
                    {
                        $result = true;
                
                        foreach ($this->types as $type => $validator) {
                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 readData has a Cognitive Complexity of 15 (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/CactiHostStatus.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 resolveRelativePositions has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function resolveRelativePositions()
                    {
                        // calculate any relative positions here - that way, nothing else
                        // really needs to know about them
                
                
                Severity: Minor
                Found in lib/Weathermap/Core/Map.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 debug has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function debug($string)
                    {
                        global $weathermap_debugging;
                        global $weathermap_map;
                        global $weathermap_debug_suppress;
                Severity: Minor
                Found in lib/Weathermap/Core/MapUtility.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 testVector has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function testVector()
                    {
                        $infiniteSlope = 10000000000.0;
                
                        $vector1 = new Vector(0, 0);
                Severity: Minor
                Found in lib/Weathermap/Tests/GeometryTest.php - About 1 hr to fix

                  Method init has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function init(&$map)
                      {
                          if ($map->context == 'cacti') {
                              $pdo = weathermap_get_pdo();
                  
                  
                  Severity: Minor
                  Found in lib/Weathermap/Plugins/Datasources/CactiTholdStatus.php - About 1 hr to fix

                    Method init has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function init(&$map)
                        {
                            if ($map->context == 'cacti') {
                                if (!function_exists('db_fetch_assoc')) {
                                    MapUtility::debug("ReadData DSStats: Cacti database library not found. [DSSTATS001]\n");
                    Severity: Minor
                    Found in lib/Weathermap/Plugins/Datasources/CactiDSStats.php - About 1 hr to fix

                      Function show_link has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function show_link(name) {
                          mapmode('existing');
                      
                          hide_all_dialogs();
                      
                      
                      Severity: Minor
                      Found in editor-resources/editor.js - About 1 hr to fix

                        Function testKeywordCoverage has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function testKeywordCoverage()
                            {
                        
                                $docsIndex = $this->docsRoot . "/index.xml";
                        
                        
                        Severity: Minor
                        Found in lib/Weathermap/Tests/DocsTest.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 checkPaths has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function checkPaths()
                            {
                                $version = explode('.', PHP_VERSION);
                                self::$phpTag = "php-" . $version[0] . "." . $version[1];
                        
                        
                        Severity: Minor
                        Found in lib/Weathermap/Tests/ConfigTest.php - About 1 hr to fix

                          Method asConfig has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function asConfig($scaleName, $kilo, $decimalPoint)
                              {
                                  $output = "";
                          
                                  $top = rtrim(
                          Severity: Minor
                          Found in lib/Weathermap/Core/ScaleEntry.php - About 1 hr to fix

                            Method main has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function main($request, $cookies, $fromPlugin = false)
                                {
                                    $mapFileName = "";
                                    $action = "";
                            
                            
                            Severity: Minor
                            Found in lib/Weathermap/Editor/EditorUI.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language