firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

File units-conversion.js has 399 lines of code (exceeds 250 allowed). Consider refactoring.
Open

NETDATA.unitsConversion = {
    keys: {},       // keys for data-common-units
    latest: {},     // latest selected units for data-common-units

    globalReset: function () {
Severity: Minor
Found in src/web/gui/src/dashboard.js/units-conversion.js - About 5 hrs to fix

    File gen_docs_integrations.py has 397 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import json
    import re
    import shutil
    from pathlib import Path
    
    
    Severity: Minor
    Found in integrations/gen_docs_integrations.py - About 5 hrs to fix

      Method Windows.collectIIS has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
      Open

      func (w *Windows) collectIIS(mx map[string]int64, pms prometheus.Series) {
          seen := make(map[string]bool)
          px := "iis_website_"
          for _, pm := range pms.FindByName(metricIISCurrentAnonymousUsers) {
              if name := cleanWebsiteName(pm.Labels.Get("site")); name != "" {
      Severity: Minor
      Found in src/go/plugin/go.d/modules/windows/collect_iis.go - About 5 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 WebLog.createCharts has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
      Open

      func (w *WebLog) createCharts(line *logLine) error {
          if line.empty() {
              return errors.New("empty line")
          }
          w.charts = nil
      Severity: Minor
      Found in src/go/plugin/go.d/modules/weblog/charts.go - About 5 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 dygraphChartUpdate has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

      NETDATA.dygraphChartUpdate = function (state, data) {
          let dygraph = state.tmp.dygraph_instance;
      
          if (typeof dygraph === 'undefined') {
              return NETDATA.dygraphChartCreate(state, data);
      Severity: Minor
      Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 5 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 renderChartsAndMenu has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

      function renderChartsAndMenu(data) {
          options.menus = {};
          options.submenu_names = {};
      
          var menus = options.menus;
      Severity: Minor
      Found in src/web/gui/main.js - About 5 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 updateChart has 132 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          this.updateChart = function (callback) {
              if (this.debug) {
                  this.log('updateChart()');
              }
      
      
      Severity: Major
      Found in src/web/gui/src/dashboard.js/main.js - About 5 hrs to fix

        Function updateChart has 132 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            this.updateChart = function (callback) {
                if (this.debug) {
                    this.log('updateChart()');
                }
        
        
        Severity: Major
        Found in src/web/gui/v1/dashboard.js - About 5 hrs to fix

          Function match_hostname has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

          def match_hostname(cert, hostname):
              """Verify that *cert* (in decoded format as returned by
              SSLSocket.getpeercert()) matches the *hostname*.  RFC 2818 and RFC 6125
              rules are followed, but IP addresses are not accepted for *hostname*.
          
          

          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 write_to_file has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

          def write_to_file(path, md, meta_yaml, sidebar_label, community, mode='default'):
              """
              takes the arguments needed to write the integration markdown to the proper file.
              """
          
          
          Severity: Minor
          Found in integrations/gen_docs_integrations.py - About 5 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 render_collectors has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
          Open

          def render_collectors(categories, collectors, ids):
              debug('Computing default categories.')
          
              default_cats, valid_cats = get_category_sets(categories)
          
          
          Severity: Minor
          Found in integrations/gen_integrations.py - About 5 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 charts.go has 628 lines of code (exceeds 500 allowed). Consider refactoring.
          Open

          // SPDX-License-Identifier: GPL-3.0-or-later
          
          package pulsar
          
          import (
          Severity: Minor
          Found in src/go/plugin/go.d/modules/pulsar/charts.go - About 5 hrs to fix

            Function get has 124 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                get: function (uuid, min, max, units, desired_units, common_units_name, switch_units_callback) {
                    // validate the parameters
                    if (typeof units === 'undefined') {
                        units = 'undefined';
                    }
            Severity: Major
            Found in src/web/gui/src/dashboard.js/units-conversion.js - About 4 hrs to fix

              Function get has 124 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  get: function (uuid, min, max, units, desired_units, common_units_name, switch_units_callback) {
                      // validate the parameters
                      if (typeof units === 'undefined') {
                          units = 'undefined';
                      }
              Severity: Major
              Found in src/web/gui/v1/dashboard.js - About 4 hrs to fix

                Function dashboardSettingsSetup has 123 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function dashboardSettingsSetup() {
                    var update_options_modal = function () {
                        // console.log('update_options_modal');
                
                        var sync_option = function (option) {
                Severity: Major
                Found in src/web/gui/main.js - About 4 hrs to fix

                  Method Bind.collectServerStats has 147 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (b *Bind) collectServerStats(metrics map[string]int64, stats *serverStats) {
                      var chart *Chart
                  
                      for k, v := range stats.NSStats {
                          var (
                  Severity: Major
                  Found in src/go/plugin/go.d/modules/bind/collect.go - About 4 hrs to fix

                    Function matchChunk has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func matchChunk(chunk, s string) (rest string, ok bool, err error) {
                        for len(chunk) > 0 {
                            if len(s) == 0 {
                                return
                            }
                    Severity: Minor
                    Found in src/go/pkg/matcher/glob.go - About 4 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 chartRefresher has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                    Open

                    NETDATA.chartRefresher = function () {
                        // console.log('chartRefresher() begin ' + (Date.now() - NETDATA.chartRefresherLastRun).toString() + ' ms since last run');
                    
                        if (NETDATA.options.page_is_visible === false
                            && NETDATA.options.current.stop_updates_when_focus_is_lost
                    Severity: Minor
                    Found in src/web/gui/src/dashboard.js/main.js - About 4 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 parseHash has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                    Open

                        parseHash: function () {
                            var variables = document.location.hash.split(';');
                            var len = variables.length;
                            while (len--) {
                                if (len !== 0) {
                    Severity: Minor
                    Found in src/web/gui/main.js - About 4 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 renderPage has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function renderPage(menus, data) {
                        var div = document.getElementById('charts_div');
                        var pcent_width = Math.floor(100 / chartsPerRow($(div).width()));
                    
                        // find the proper duration for per-second updates
                    Severity: Major
                    Found in src/web/gui/main.js - About 4 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language