firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

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

func (v *Varnish) collectStatistics(mx map[string]int64, bs []byte) error {
    seenBackends, seenStorages := make(map[string]bool), make(map[string]bool)

    sc := bufio.NewScanner(bytes.NewReader(bs))

Severity: Minor
Found in src/go/plugin/go.d/modules/varnish/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

Function object has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    object: function (name, obj, ignore_regex) {
        if (typeof ignore_regex !== 'undefined' && ignore_regex.test(name)) {
            // console.log('XSS: ignoring "' + name + '"');
            return obj;
        }
Severity: Minor
Found in src/web/gui/src/dashboard.js/xss.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

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

# -*- coding: utf-8 -*-
# Description: haproxy netdata python.d module
# Author: ilyam8, ktarasz
# SPDX-License-Identifier: GPL-3.0-or-later

Severity: Minor
Found in src/collectors/python.d.plugin/haproxy/haproxy.chart.py - About 3 hrs to fix

    Function easypiechartChartCreate has 96 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Function easypiechartChartCreate has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        WebLog has 31 methods (exceeds 20 allowed). Consider refactoring.
        Open

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

          Parser has 31 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Parser:
              # Since writing a recursive-descendant parser is a straightforward task, we
              # do not give many comments here.
          
              DEFAULT_TAGS = {
          Severity: Minor
          Found in src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py - About 3 hrs to fix

            File utils.js has 324 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // *** src/dashboard.js/utils.js
            
            NETDATA.name2id = function (s) {
                return s
                    .replace(/ /g, '_')
            Severity: Minor
            Found in src/web/gui/src/dashboard.js/utils.js - About 3 hrs to fix

              Function canBeAutoRefreshed has 94 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  this.canBeAutoRefreshed = function () {
                      if (!this.enabled) {
                          if (this.debug) {
                              this.log('canBeAutoRefreshed() -> not enabled');
                          }
              Severity: Major
              Found in src/web/gui/src/dashboard.js/main.js - About 3 hrs to fix

                Function canBeAutoRefreshed has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    this.canBeAutoRefreshed = function () {
                        if (!this.enabled) {
                            if (this.debug) {
                                this.log('canBeAutoRefreshed() -> not enabled');
                            }
                Severity: Major
                Found in src/web/gui/v1/dashboard.js - About 3 hrs to fix

                  File charts.py has 323 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  # Description:
                  # Author: Ilya Mashchenko (ilyam8)
                  # SPDX-License-Identifier: GPL-3.0-or-later
                  
                  
                  Severity: Minor
                  Found in src/collectors/python.d.plugin/python_modules/bases/charts.py - About 3 hrs to fix

                    Method Hpssa.updateCharts has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (h *Hpssa) updateCharts(controllers map[string]*hpssaController) {
                        seenControllers := make(map[string]bool)
                        seenArrays := make(map[string]bool)
                        seenLDrives := make(map[string]bool)
                        seenPDrives := make(map[string]bool)
                    Severity: Minor
                    Found in src/go/plugin/go.d/modules/hpssa/charts.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 Dnsmasq.collectCacheStatistics has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (d *Dnsmasq) collectCacheStatistics(mx map[string]int64) error {
                        /*
                            ;; flags: qr aa rd ra; QUERY: 7, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 0
                    
                            ;; QUESTION SECTION:
                    Severity: Minor
                    Found in src/go/plugin/go.d/modules/dnsmasq/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

                    Function object has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                    Open

                      object: function (name, obj, ignore_regex) {
                        if (typeof ignore_regex !== 'undefined' && ignore_regex.test(name)) {
                          // console.log('XSS: ignoring "' + name + '"');
                          return obj;
                        }
                    Severity: Minor
                    Found in src/web/gui/v1/dashboard-react.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

                    Method NginxPlus.updateCharts has 118 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (n *NginxPlus) updateCharts() {
                        const notSeenLimit = 3
                    
                        for key, v := range n.cache.httpCaches {
                            if v.updated && !v.hasCharts {
                    Severity: Major
                    Found in src/go/plugin/go.d/modules/nginxplus/collect.go - About 3 hrs to fix

                      Function chartRefresher has 92 lines of code (exceeds 25 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: Major
                      Found in src/web/gui/v1/dashboard.js - About 3 hrs to fix

                        Function chartRefresher has 92 lines of code (exceeds 25 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: Major
                        Found in src/web/gui/src/dashboard.js/main.js - About 3 hrs to fix

                          File poolmanager.py has 320 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          # SPDX-License-Identifier: MIT
                          from __future__ import absolute_import
                          import collections
                          import functools
                          import logging
                          Severity: Minor
                          Found in src/collectors/python.d.plugin/python_modules/urllib3/poolmanager.py - About 3 hrs to fix

                            File gauge.js has 317 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            // gauge.js
                            
                            NETDATA.gaugeInitialize = function (callback) {
                                if (typeof netdataNoGauge === 'undefined' || !netdataNoGauge) {
                                    $.ajax({
                            Severity: Minor
                            Found in src/web/gui/src/dashboard.js/charting/gauge.js - About 3 hrs to fix

                              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/v1/dashboard.js - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language