netdata/netdata

View on GitHub

Showing 1,245 of 2,987 total issues

Function d3pieChartCreate has 156 lines of code (exceeds 25 allowed). Consider refactoring.
Open

NETDATA.d3pieChartCreate = function (state, data) {

    state.element_chart.id = 'd3pie-' + state.uuid;
    // console.log('id = ' + state.element_chart.id);

Severity: Major
Found in src/web/gui/v1/dashboard.js - About 6 hrs to fix

    File charts.go has 664 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

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

      Method Bind.collectServerStats has a Cognitive Complexity of 54 (exceeds 20 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: Minor
      Found in src/go/collectors/go.d.plugin/modules/bind/collect.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

      File parser.py has 412 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # SPDX-License-Identifier: MIT
      
      # The following YAML grammar is LL(1) and is parsed by a recursive descent
      # parser.
      #
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py - About 5 hrs to fix

        File parser.py has 412 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # SPDX-License-Identifier: MIT
        
        # The following YAML grammar is LL(1) and is parsed by a recursive descent
        # parser.
        #
        Severity: Minor
        Found in src/collectors/python.d.plugin/python_modules/pyyaml2/parser.py - About 5 hrs to fix

          Function gaugeChartCreate has 147 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          NETDATA.gaugeChartCreate = function (state, data) {
              // let chart = $(state.element_chart);
          
              let value = data.result[0];
              let min = NETDATA.dataAttribute(state.element, 'gauge-min-value', null);
          Severity: Major
          Found in src/web/gui/src/dashboard.js/charting/gauge.js - About 5 hrs to fix

            Function gaugeChartCreate has 147 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            NETDATA.gaugeChartCreate = function (state, data) {
                // let chart = $(state.element_chart);
            
                let value = data.result[0];
                let min = NETDATA.dataAttribute(state.element, 'gauge-min-value', null);
            Severity: Major
            Found in src/web/gui/v1/dashboard.js - About 5 hrs to fix

              Function write_literal has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
              Open

                  def write_literal(self, text):
                      hints = self.determine_block_hints(text)
                      self.write_indicator('|'+hints, True)
                      if hints[-1:] == '+':
                          self.open_ended = True
              Severity: Minor
              Found in src/collectors/python.d.plugin/python_modules/pyyaml3/emitter.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 write_literal has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
              Open

                  def write_literal(self, text):
                      hints = self.determine_block_hints(text)
                      self.write_indicator(u'|'+hints, True)
                      if hints[-1:] == u'+':
                          self.open_ended = True
              Severity: Minor
              Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.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 promport.go has 656 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              // SPDX-License-Identifier: GPL-3.0-or-later
              
              package pipeline
              
              // https://github.com/prometheus/prometheus/wiki/Default-port-allocations
              Severity: Minor
              Found in src/go/collectors/go.d.plugin/agent/discovery/sd/pipeline/promport.go - About 5 hrs to fix

                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

                  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/collectors/go.d.plugin/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

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

                  func (s *StorCli) collectMegaRaidDrives(mx map[string]int64, resp *drivesInfoResponse) error {
                      for _, cntrl := range resp.Controllers {
                          var ids []string
                          for k := range cntrl.ResponseData {
                              if !strings.HasSuffix(k, "Detailed Information") {
                  Severity: Minor
                  Found in src/go/collectors/go.d.plugin/modules/storcli/collect_drives.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 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/collectors/go.d.plugin/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

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

                  def build_readme_from_integration(integration, mode=''):
                      # COLLECTORS
                      if mode == 'collector':
                  
                          try:
                  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 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

                      Severity
                      Category
                      Status
                      Source
                      Language