firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

Method ProxySQL.collect has 7 return statements (exceeds 4 allowed).
Open

func (p *ProxySQL) collect() (map[string]int64, error) {
    if p.db == nil {
        if err := p.openConnection(); err != nil {
            return nil, err
        }
Severity: Major
Found in src/go/plugin/go.d/modules/proxysql/collect.go - About 45 mins to fix

    Method Ceph.authLogin has 7 return statements (exceeds 4 allowed).
    Open

    func (c *Ceph) authLogin() (string, error) {
        // https://docs.ceph.com/en/reef/mgr/ceph_api/#post--api-auth
    
        req, err := func() (*http.Request, error) {
            var credentials = struct {
    Severity: Major
    Found in src/go/plugin/go.d/modules/ceph/auth.go - About 45 mins to fix

      Method Dnsmasq.collectCacheStatistics has 7 return statements (exceeds 4 allowed).
      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: Major
      Found in src/go/plugin/go.d/modules/dnsmasq/collect.go - About 45 mins to fix

        Method HDFS.determineNodeType has 7 return statements (exceeds 4 allowed).
        Open

        func (h *HDFS) determineNodeType() (nodeType, error) {
            req, err := web.NewHTTPRequest(h.RequestConfig)
            if err != nil {
                return "", fmt.Errorf("failed to create HTTP request: %v", err)
            }
        Severity: Major
        Found in src/go/plugin/go.d/modules/hdfs/collect.go - About 45 mins to fix

          Function dataAttributeBoolean has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          NETDATA.dataAttributeBoolean = function (element, attribute, def) {
              let value = NETDATA.dataAttribute(element, attribute, def);
          
              if (value === true || value === false) // gmosx: Love this :)
              {
          Severity: Minor
          Found in src/web/gui/src/dashboard.js/utils.js - About 45 mins 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 setMaster has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              setMaster: function (state, after, before) {
                  this.delay();
          
                  if (!NETDATA.options.current.sync_pan_and_zoom) {
                      return;
          Severity: Minor
          Found in src/web/gui/src/dashboard.js/main.js - About 45 mins 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 setOption has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          NETDATA.setOption = function (key, value) {
              if (key.toString() === 'setOptionCallback') {
                  if (typeof NETDATA.options.current.setOptionCallback === 'function') {
                      NETDATA.options.current[key.toString()] = value;
                      NETDATA.options.current.setOptionCallback();
          Severity: Minor
          Found in src/web/gui/src/dashboard.js/localstorage.js - About 45 mins 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

          Avoid deeply nested control flow statements.
          Open

                              if (this.convertibleUnits[units].hasOwnProperty(x)) {
                                  if (this.convertibleUnits[units][x].check(max)) {
                                      //console.log('DEBUG: ' + uuid.toString() + ' converting ' + units.toString() + ' to: ' + x.toString());
                                      switch_units_callback(x);
                                      return this.convertibleUnits[units][x].convert;
          Severity: Major
          Found in src/web/gui/src/dashboard.js/units-conversion.js - About 45 mins to fix

            Function init has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                init: function () {
                    let custom = true;
            
                    if (window.requestAnimationFrame) {
                        this.step = function (callback) {
            Severity: Minor
            Found in src/web/gui/src/dashboard.js/timeout.js - About 45 mins 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

            Avoid deeply nested control flow statements.
            Open

                                if len(pattern) == 0 && len(t) > 0 {
                                    continue
                                }
            Severity: Major
            Found in src/go/pkg/matcher/glob.go - About 45 mins to fix

              Function setup has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  setup: function () {
                      if (this.isActive()) {
                          if (this.state === null) {
                              this.state = NETDATA.options.targets[0];
                          }
              Severity: Minor
              Found in src/web/gui/src/dashboard.js/main.js - About 45 mins 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 setOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              dimensionStatus.prototype.setOptions = function (name_div, value_div, color) {
                  this.color = color;
              
                  if (this.name_div !== name_div) {
                      this.name_div = name_div;
              Severity: Minor
              Found in src/web/gui/src/dashboard.js/main.js - About 45 mins 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

              Avoid deeply nested control flow statements.
              Open

                                  if hi, chunk, err = getEsc(chunk[1:]); err != nil {
                                      return
                                  }
              Severity: Major
              Found in src/go/pkg/matcher/glob.go - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (t.hasOwnProperty(x) && t[x].divider > common_units.divider) {
                                            common_units = t[x];
                                        }
                Severity: Major
                Found in src/web/gui/src/dashboard.js/units-conversion.js - About 45 mins to fix

                  Method API.DIMENSION has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      ID string,
                      name string,
                      algorithm string,
                      multiplier int,
                      divisor int,
                  Severity: Minor
                  Found in src/go/pkg/netdataapi/api.go - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if (this.convertibleUnits[units].hasOwnProperty(x)) {
                                            if (this.convertibleUnits[units][x].check(max)) {
                                                //console.log('DEBUG: ' + uuid.toString() + ' converting ' + units.toString() + ' to: ' + x.toString());
                                                switch_units_callback(x);
                                                return this.convertibleUnits[units][x].convert;
                    Severity: Major
                    Found in src/web/gui/v1/dashboard.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if (t.hasOwnProperty(x) && t[x].divider > common_units.divider) {
                                                  common_units = t[x];
                                              }
                      Severity: Major
                      Found in src/web/gui/v1/dashboard.js - About 45 mins to fix

                        Function activeForRecipients has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            activeForRecipients: function () {
                                let active = {};
                                let data = NETDATA.alarms.current;
                        
                                if (typeof data === 'undefined' || data === null) {
                        Severity: Minor
                        Found in src/web/gui/src/dashboard.js/alarms.js - About 45 mins 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

                        Avoid deeply nested control flow statements.
                        Open

                                                if element['name'] != 'netdata-repo' and element['name'] != 'netdata-repo-edge':
                                                    all_pkg_list.append(element)
                                    page += 1
                        Severity: Major
                        Found in .github/scripts/netdata-pkgcloud-cleanup.py - About 45 mins to fix

                          Function send has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def send(self, out_type, out_data):
                                  if self.socket is None:
                                      raise MCRconException("Must connect before sending data")
                          
                                  # Send a request packet
                          Severity: Minor
                          Found in src/collectors/python.d.plugin/python_modules/third_party/mcrcon.py - About 45 mins 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