firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

Function lateInitialization has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    const lateInitialization = () => {
        if (typeof this.host !== 'undefined') {
            return;
        }

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

    Function renderMachines has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    function renderMachines(machinesArray) {
        let html = `<div class="info-item">My nodes</div>`;
    
        if (machinesArray === null) {
            let ret = loadLocalStorage("registryCallback");
    Severity: Minor
    Found in src/web/gui/main.js - 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

    Function resizeHandler has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        this.resizeHandler = function (e) {
            e.preventDefault();
    
            if (typeof this.event_resize === 'undefined'
                || this.event_resize.chart_original_w === 'undefined'
    Severity: Major
    Found in src/web/gui/v1/dashboard.js - About 3 hrs to fix

      Function resizeHandler has 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          this.resizeHandler = function (e) {
              e.preventDefault();
      
              if (typeof this.event_resize === 'undefined'
                  || this.event_resize.chart_original_w === 'undefined'
      Severity: Major
      Found in src/web/gui/src/dashboard.js/main.js - About 3 hrs to fix

        Function __init__ has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, display_name):
                self.display_name = display_name
        
                if self.display_name == "alpine_3_18":
                    self.docker_tag = "alpine:3.18"
        Severity: Minor
        Found in packaging/dag/nd.py - 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

        Function flatten_mapping has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def flatten_mapping(self, node):
                merge = []
                index = 0
                while index < len(node.value):
                    key_node, value_node = node.value[index]
        Severity: Minor
        Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py - 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

        Function increment has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def increment(self, method=None, url=None, response=None, error=None,
                          _pool=None, _stacktrace=None):
                """ Return a new Retry object with incremented retry counters.
        
                :param response: A response object, or None, if the server did not
        Severity: Minor
        Found in src/collectors/python.d.plugin/python_modules/urllib3/util/retry.py - 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

        Function _read_callback has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

        def _read_callback(connection_id, data_buffer, data_length_pointer):
            """
            SecureTransport read callback. This is called by ST to request that data
            be returned from the socket.
            """

        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 85 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            parseHash: function () {
                var variables = document.location.hash.split(';');
                var len = variables.length;
                while (len--) {
                    if (len !== 0) {
        Severity: Major
        Found in src/web/gui/main.js - About 3 hrs to fix

          Function extend has 84 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var extend = function() {
              var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {},
                  i = 1,
                  length = arguments.length,
                  deep = false,
          Severity: Major
          Found in src/web/gui/v1/lib/d3pie-0.2.1-netdata-3.js - About 3 hrs to fix

            SquidLog has 28 methods (exceeds 20 allowed). Consider refactoring.
            Open

            func (s *SquidLog) logPanicStackIfAny() {
                err := recover()
                if err == nil {
                    return
                }
            Severity: Minor
            Found in src/go/plugin/go.d/modules/squidlog/collect.go - About 3 hrs to fix

              Function notify has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  notify: function (entry) {
                      // console.log('alarm ' + entry.unique_id);
              
                      if (entry.updated) {
                          // console.log('alarm ' + entry.unique_id + ' has been updated by another alarm');
              Severity: Major
              Found in src/web/gui/src/dashboard.js/alarms.js - About 3 hrs to fix

                Function notify has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    notify: function (entry) {
                        // console.log('alarm ' + entry.unique_id);
                
                        if (entry.updated) {
                            // console.log('alarm ' + entry.unique_id + ' has been updated by another alarm');
                Severity: Major
                Found in src/web/gui/v1/dashboard.js - About 3 hrs to fix

                  Method KubeState.collectPodsState has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (ks *KubeState) collectPodsState(mx map[string]int64) {
                      now := time.Now()
                      for _, ps := range ks.state.pods {
                          // Skip cronjobs (each of them is a unique container because name contains hash)
                          // to avoid overwhelming Netdata with high cardinality metrics.
                  Severity: Minor
                  Found in src/go/plugin/go.d/modules/k8s_state/collect.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

                  Method Smartctl.collectSmartDevice has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (s *Smartctl) collectSmartDevice(mx map[string]int64, dev *smartDevice) {
                      px := fmt.Sprintf("device_%s_type_%s_", dev.deviceName(), dev.deviceType())
                  
                      if v, ok := dev.powerOnTime(); ok {
                          mx[px+"power_on_time"] = v
                  Severity: Minor
                  Found in src/go/plugin/go.d/modules/smartctl/collect.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

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

                  func (w *Windows) collectLogicalDisk(mx map[string]int64, pms prometheus.Series) {
                      seen := make(map[string]bool)
                      px := "logical_disk_"
                      for _, pm := range pms.FindByName(metricLDReadBytesTotal) {
                          vol := pm.Labels.Get("volume")
                  Severity: Minor
                  Found in src/go/plugin/go.d/modules/windows/collect_logical_disk.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

                  Function choose_scalar_style has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def choose_scalar_style(self):
                          if self.analysis is None:
                              self.analysis = self.analyze_scalar(self.event.value)
                          if self.event.style == '"' or self.canonical:
                              return '"'
                  Severity: Minor
                  Found in src/collectors/python.d.plugin/python_modules/pyyaml3/emitter.py - 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

                  Function main has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def main():
                      if len(sys.argv) != 2:
                          print(':error:This script takes exactly one argument.')
                          return 2
                  
                  
                  Severity: Minor
                  Found in integrations/check_collector_metadata.py - 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

                  Method KubeState.collectPodsState has 105 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (ks *KubeState) collectPodsState(mx map[string]int64) {
                      now := time.Now()
                      for _, ps := range ks.state.pods {
                          // Skip cronjobs (each of them is a unique container because name contains hash)
                          // to avoid overwhelming Netdata with high cardinality metrics.
                  Severity: Major
                  Found in src/go/plugin/go.d/modules/k8s_state/collect.go - About 3 hrs to fix

                    Function dygraphChartUpdate has 80 lines of code (exceeds 25 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: Major
                    Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 3 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language