netdata/netdata

View on GitHub

Showing 1,247 of 3,010 total issues

Function updateChartWithData has 109 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    this.updateChartWithData = function (data) {
        if (this.debug) {
            this.log('updateChartWithData() called.');
        }

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

    File anomalies.chart.py has 347 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    # Description: anomalies netdata python.d module
    # Author: andrewm4894
    # SPDX-License-Identifier: GPL-3.0-or-later
    
    
    Severity: Minor
    Found in src/collectors/python.d.plugin/anomalies/anomalies.chart.py - About 4 hrs to fix

      Function sparklineChartCreate has 108 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      NETDATA.sparklineChartCreate = function (state, data) {
          let type = NETDATA.dataAttribute(state.element, 'sparkline-type', 'line');
          let lineColor = NETDATA.dataAttribute(state.element, 'sparkline-linecolor', state.chartCustomColors()[0]);
          let fillColor = NETDATA.dataAttribute(state.element, 'sparkline-fillcolor', ((state.chart.chart_type === 'line') ? NETDATA.themes.current.background : NETDATA.colorLuminance(lineColor, NETDATA.chartDefaults.fill_luminance)));
          let chartRangeMin = NETDATA.dataAttribute(state.element, 'sparkline-chartrangemin', undefined);
      Severity: Major
      Found in src/web/gui/src/dashboard.js/charting/sparkline.js - About 4 hrs to fix

        Function sparklineChartCreate has 108 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        NETDATA.sparklineChartCreate = function (state, data) {
            let type = NETDATA.dataAttribute(state.element, 'sparkline-type', 'line');
            let lineColor = NETDATA.dataAttribute(state.element, 'sparkline-linecolor', state.chartCustomColors()[0]);
            let fillColor = NETDATA.dataAttribute(state.element, 'sparkline-fillcolor', ((state.chart.chart_type === 'line') ? NETDATA.themes.current.background : NETDATA.colorLuminance(lineColor, NETDATA.chartDefaults.fill_luminance)));
            let chartRangeMin = NETDATA.dataAttribute(state.element, 'sparkline-chartrangemin', undefined);
        Severity: Major
        Found in src/web/gui/v1/dashboard.js - About 4 hrs to fix

          File pyopenssl.py has 346 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # SPDX-License-Identifier: MIT
          """
          SSL with SNI_-support for Python 2. Follow these instructions if you would
          like to verify SSL certificates in Python 2. Note, the default libraries do
          *not* do certificate checking; you need to do additional work to validate

            Function shorten has 107 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                $.fn.shorten = function (settings) {
                    "use strict";
            
                    var config = {
                        showChars: 750,
            Severity: Major
            Found in src/web/gui/main.js - About 4 hrs to fix

              Function urlopen has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
              Open

                  def urlopen(self, method, url, body=None, headers=None,
                              retries=None, redirect=True, timeout=Timeout.DEFAULT_TIMEOUT,
                              **response_kw):
              
                      retries = self._get_retries(retries, redirect)

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

                  def get_data(self):
                      if not self.alive and not self.reconnect():
                          return None
              
                      data = dict()
              Severity: Minor
              Found in src/collectors/python.d.plugin/oracledb/oracledb.chart.py - 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 check has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
              Open

                  def check(self):
                      def get_connection_properties(conf, extra_conf):
                          properties = dict()
                          if conf.get('user'):
                              properties['user'] = conf['user']

              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

              logLine has 33 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  logLine struct {
                      clientAddr string
                      serverAddr string
              
                      respTime int
              Severity: Minor
              Found in src/go/collectors/go.d.plugin/modules/squidlog/logline.go - About 4 hrs to fix

                Function renderMachines has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function renderMachines(machinesArray) {
                    let html = `<div class="info-item">My nodes</div>`;
                
                    if (machinesArray === null) {
                        let ret = loadLocalStorage("registryCallback");
                Severity: Major
                Found in src/web/gui/main.js - About 4 hrs to fix

                  Method KubeState.updatePodState has 128 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (ks *KubeState) updatePodState(r resource) {
                      if r.value() == nil {
                          if ps, ok := ks.state.pods[r.source()]; ok {
                              ps.deleted = true
                          }
                  Severity: Major
                  Found in src/go/collectors/go.d.plugin/modules/k8s_state/update_pod_state.go - About 4 hrs to fix

                    Function scan_flow_scalar_non_spaces has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def scan_flow_scalar_non_spaces(self, double, start_mark):
                            # See the specification for details.
                            chunks = []
                            while True:
                                length = 0
                    Severity: Minor
                    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/scanner.py - 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 construct_object has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def construct_object(self, node, deep=False):
                            if node in self.constructed_objects:
                                return self.constructed_objects[node]
                            if deep:
                                old_deep = self.deep_construct
                    Severity: Minor
                    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py - 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 scan_flow_scalar_non_spaces has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def scan_flow_scalar_non_spaces(self, double, start_mark):
                            # See the specification for details.
                            chunks = []
                            while True:
                                length = 0
                    Severity: Minor
                    Found in src/collectors/python.d.plugin/python_modules/pyyaml2/scanner.py - 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 construct_object has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def construct_object(self, node, deep=False):
                            if node in self.constructed_objects:
                                return self.constructed_objects[node]
                            if deep:
                                old_deep = self.deep_construct
                    Severity: Minor
                    Found in src/collectors/python.d.plugin/python_modules/pyyaml2/constructor.py - 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

                    File nd.py has 335 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    from typing import List
                    
                    import enum
                    import os
                    import pathlib
                    Severity: Minor
                    Found in packaging/dag/nd.py - About 4 hrs to fix

                      Function enrichChartData has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function enrichChartData(chart) {
                          var parts = chart.type.split('_');
                          var tmp = parts[0];
                      
                          switch (tmp) {
                      Severity: Major
                      Found in src/web/gui/main.js - About 4 hrs to fix

                        File ceph.chart.py has 333 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        # -*- coding: utf-8 -*-
                        # Description: ceph netdata python.d module
                        # Author: Luis Eduardo (lets00)
                        # SPDX-License-Identifier: GPL-3.0-or-later
                        
                        
                        Severity: Minor
                        Found in src/collectors/python.d.plugin/ceph/ceph.chart.py - About 4 hrs to fix

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

                          func (w *Windows) collectNetFrameworkCLRMemory(mx map[string]int64, pms prometheus.Series) {
                              seen := make(map[string]bool)
                          
                              for _, pm := range pms.FindByName(metricNetFrameworkCLRMemoryAllocatedBytesTotal) {
                                  if name := cleanProcessName(pm.Labels.Get("process")); name != "" {
                          Severity: Minor
                          Found in src/go/collectors/go.d.plugin/modules/windows/collect_netframework.go - About 3 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

                          Severity
                          Category
                          Status
                          Source
                          Language