howardjones/network-weathermap

View on GitHub

Showing 1,091 of 1,093 total issues

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

        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

        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

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

            const isLocalhost = Boolean(
              window.location.hostname === 'localhost' ||
                // [::1] is the IPv6 localhost address.
                window.location.hostname === '[::1]' ||
                // 127.0.0.1/8 is considered localhost for IPv4.
            Severity: Major
            Found in websrc/cacti-user/src/registerServiceWorker.js and 1 other location - About 1 hr to fix
            websrc/cacti-mgmt/src/registerServiceWorker.js on lines 11..19

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

            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

            const isLocalhost = Boolean(
              window.location.hostname === 'localhost' ||
                // [::1] is the IPv6 localhost address.
                window.location.hostname === '[::1]' ||
                // 127.0.0.1/8 is considered localhost for IPv4.
            Severity: Major
            Found in websrc/cacti-mgmt/src/registerServiceWorker.js and 1 other location - About 1 hr to fix
            websrc/cacti-user/src/registerServiceWorker.js on lines 11..19

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

            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

            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

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

                      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

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

                            if (m === 'xy') {
                                document.getElementById('debug').value = "xy";
                                document.getElementById('xycapture').style.display = 'inline';
                                document.getElementById('existingdata').style.display = 'none';
                            } else if (m === 'existing') {
                        Severity: Major
                        Found in editor-resources/editor.js and 1 other location - About 1 hr to fix
                        editor-resources/editor.js on lines 327..333

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

                        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

                            } else if (m === 'existing') {
                                document.getElementById('debug').value = "existing";
                                document.getElementById('xycapture').style.display = 'none';
                                document.getElementById('existingdata').style.display = 'inline';
                            } else {
                        Severity: Major
                        Found in editor-resources/editor.js and 1 other location - About 1 hr to fix
                        editor-resources/editor.js on lines 323..333

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

                        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