howardjones/network-weathermap

View on GitHub

Showing 1,091 of 1,093 total issues

EditorUI has 52 functions (exceeds 20 allowed). Consider refactoring.
Open

class EditorUI extends UIBase
{
    private $editor;

    private $selected = "";
Severity: Major
Found in lib/Weathermap/Editor/EditorUI.php - About 7 hrs to fix

    Function moveNode has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

        public function moveNode($nodeName, $newX, $newY)
        {
            if (!$this->isLoaded()) {
                throw new WeathermapInternalFail("Map must be loaded before editing API called.");
            }
    Severity: Minor
    Found in lib/Weathermap/Editor/Editor.php - About 7 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 readFromPollerOutput has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

        private function readFromPollerOutput($rrdfile, $cf, $start, $end, $dsnames, &$map, &$item)
        {
            global $config;
    
            $pdo = weathermap_get_pdo();
    Severity: Minor
    Found in lib/Weathermap/Plugins/Datasources/RRDTool.php - About 7 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

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

    function checkValidServiceWorker(swUrl) {
      // Check if the service worker can be found. If it can't reload the page.
      fetch(swUrl)
        .then(response => {
          // Ensure service worker exists, and that we really are getting a JS file.
    Severity: Major
    Found in websrc/cacti-user/src/registerServiceWorker.js and 1 other location - About 7 hrs to fix
    websrc/cacti-mgmt/src/registerServiceWorker.js on lines 75..100

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

    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

    function checkValidServiceWorker(swUrl) {
      // Check if the service worker can be found. If it can't reload the page.
      fetch(swUrl)
        .then(response => {
          // Ensure service worker exists, and that we really are getting a JS file.
    Severity: Major
    Found in websrc/cacti-mgmt/src/registerServiceWorker.js and 1 other location - About 7 hrs to fix
    websrc/cacti-user/src/registerServiceWorker.js on lines 75..100

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

    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

    Method maplist has 176 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function maplist()
        {
            \html_start_box(
                __('Weathermaps'),
                '100%',
    Severity: Major
    Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.php - About 7 hrs to fix

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

      function registerValidSW(swUrl) {
        navigator.serviceWorker
          .register(swUrl)
          .then(registration => {
            registration.onupdatefound = () => {
      Severity: Major
      Found in websrc/cacti-mgmt/src/registerServiceWorker.js and 1 other location - About 6 hrs to fix
      websrc/cacti-user/src/registerServiceWorker.js on lines 46..73

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

      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

      function registerValidSW(swUrl) {
        navigator.serviceWorker
          .register(swUrl)
          .then(registration => {
            registration.onupdatefound = () => {
      Severity: Major
      Found in websrc/cacti-user/src/registerServiceWorker.js and 1 other location - About 6 hrs to fix
      websrc/cacti-mgmt/src/registerServiceWorker.js on lines 46..73

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

      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

      WeatherMapCactiManagementPlugin has 49 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class WeatherMapCactiManagementPlugin extends UIBase
      {
      
          public $cactiBasePath;
          /** @var MapManager $manager */
      Severity: Minor
      Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.php - About 6 hrs to fix

        Function weathermap_poller_output has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
        Open

        function weathermap_poller_output($rrdUpdateArray)
        {
            global $config;
        
            $pdo = weathermap_get_pdo();
        Severity: Minor
        Found in lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php - About 6 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 readFromRealRRDtool has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            private function readFromRealRRDtool($rrdfile, $cf, $start, $end, $dsnames, &$map, &$item)
            {
                MapUtility::debug("RRD ReadData: traditional style\n");
        
                // we get the last 800 seconds of data - this might be 1 or 2 lines, depending on when in the
        Severity: Minor
        Found in lib/Weathermap/Plugins/Datasources/RRDTool.php - About 6 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

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

        export default function register() {
          if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
            // The URL constructor is available in all browsers that support SW.
            const publicUrl = new URL(process.env.PUBLIC_URL, window.location);
            if (publicUrl.origin !== window.location.origin) {
        Severity: Major
        Found in websrc/cacti-user/src/registerServiceWorker.js and 1 other location - About 6 hrs to fix
        websrc/cacti-mgmt/src/registerServiceWorker.js on lines 21..44

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

        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

        export default function register() {
          if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
            // The URL constructor is available in all browsers that support SW.
            const publicUrl = new URL(process.env.PUBLIC_URL, window.location);
            if (publicUrl.origin !== window.location.origin) {
        Severity: Major
        Found in websrc/cacti-mgmt/src/registerServiceWorker.js and 1 other location - About 6 hrs to fix
        websrc/cacti-user/src/registerServiceWorker.js on lines 21..44

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

        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

        File Legend.php has 433 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace Weathermap\Core;
        
        /**
        Severity: Minor
        Found in lib/Weathermap/Core/Legend.php - About 6 hrs to fix

          File cacti88-plugin-hooks.php has 429 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          function weathermap_setup_table()
          {
              $dbversion = \read_config_option('weathermap_db_version');
          
          
          Severity: Minor
          Found in lib/Weathermap/Integrations/Cacti/cacti88-plugin-hooks.php - About 6 hrs to fix

            Function readData has a Cognitive Complexity of 41 (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/SNMP1.php - About 6 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 calculateImagemap has a Cognitive Complexity of 41 (exceeds 5 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 6 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 41 (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/SNMP2c.php - About 6 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

            File cacti10-plugin-hooks.php has 418 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            function weathermap_setup_table()
            {
                $dbversion = \read_config_option('weathermap_db_version');
            Severity: Minor
            Found in lib/Weathermap/Integrations/Cacti/cacti10-plugin-hooks.php - About 6 hrs to fix

              File RRDTool.php has 414 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              // RRDtool datasource plugin.
              //     gauge:filename.rrd:ds_in:ds_out
              //     filename.rrd:ds_in:ds_out
              //     filename.rrd:ds_in:ds_out
              Severity: Minor
              Found in lib/Weathermap/Plugins/Datasources/RRDTool.php - About 5 hrs to fix
                Severity
                Category
                Status
                Source
                Language