firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

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

// SPDX-License-Identifier: GPL-3.0-or-later

package vernemq

import (
Severity: Major
Found in src/go/plugin/go.d/modules/vernemq/charts.go - About 1 day to fix

    Function legendUpdateDOM has 387 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        this.legendUpdateDOM = function () {
            let needed = false, dim, keys, len;
    
            // check that the legend DOM is up to date for the downloaded dimensions
            if (typeof this.element_legend_childs.series !== 'object' || this.element_legend_childs.series === null) {
    Severity: Major
    Found in src/web/gui/v1/dashboard.js - About 1 day to fix

      Function legendUpdateDOM has 387 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          this.legendUpdateDOM = function () {
              let needed = false, dim, keys, len;
      
              // check that the legend DOM is up to date for the downloaded dimensions
              if (typeof this.element_legend_childs.series !== 'object' || this.element_legend_childs.series === null) {
      Severity: Major
      Found in src/web/gui/src/dashboard.js/main.js - About 1 day to fix

        File dygraph.js has 762 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // dygraph
        
        // Codacy declarations
        /* global smoothPlotter */
        /* global Dygraph */
        Severity: Major
        Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 1 day to fix

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

          // SPDX-License-Identifier: GPL-3.0-or-later
          
          package mongo
          
          import (
          Severity: Major
          Found in src/go/plugin/go.d/modules/mongodb/charts.go - About 1 day to fix

            File gen_integrations.py has 727 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            #!/usr/bin/env python3
            
            import json
            import os
            import re
            Severity: Major
            Found in integrations/gen_integrations.py - About 1 day to fix

              Function analyze_scalar has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
              Open

                  def analyze_scalar(self, scalar):
              
                      # Empty scalar is a special case.
                      if not scalar:
                          return ScalarAnalysis(scalar=scalar, empty=True, multiline=False,
              Severity: Minor
              Found in src/collectors/python.d.plugin/python_modules/pyyaml3/emitter.py - About 1 day 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 charts.go has 938 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              // SPDX-License-Identifier: GPL-3.0-or-later
              
              package clickhouse
              
              import (
              Severity: Major
              Found in src/go/plugin/go.d/modules/clickhouse/charts.go - About 1 day to fix

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

                // SPDX-License-Identifier: GPL-3.0-or-later
                
                package nginxplus
                
                import (
                Severity: Major
                Found in src/go/plugin/go.d/modules/nginxplus/charts.go - About 1 day to fix

                  File six.py has 654 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  """Utilities for writing code that runs on Python 2 and 3"""
                  
                  # Copyright (c) 2010-2015 Benjamin Peterson
                  #
                  # SPDX-License-Identifier: MIT
                  Severity: Major
                  Found in src/collectors/python.d.plugin/python_modules/urllib3/packages/six.py - About 1 day to fix

                    Function runOnceOnDashboardWithjQuery has 281 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function runOnceOnDashboardWithjQuery() {
                        if (runOnceOnDashboardLastRun !== 0) {
                            scrollDashboardTo();
                    
                            // restore the scrollspy at the proper position
                    Severity: Major
                    Found in src/web/gui/main.js - About 1 day to fix

                      File connectionpool.py has 622 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      # SPDX-License-Identifier: MIT
                      from __future__ import absolute_import
                      import errno
                      import logging
                      import sys

                        Function get has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
                        Open

                            get: function (uuid, min, max, units, desired_units, common_units_name, switch_units_callback) {
                                // validate the parameters
                                if (typeof units === 'undefined') {
                                    units = 'undefined';
                                }
                        Severity: Minor
                        Found in src/web/gui/src/dashboard.js/units-conversion.js - About 1 day 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

                        Scanner has 71 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Scanner:
                        
                            def __init__(self):
                                """Initialize the scanner."""
                                # It is assumed that Scanner and Reader will have a common descendant.
                        Severity: Major
                        Found in src/collectors/python.d.plugin/python_modules/pyyaml3/scanner.py - About 1 day to fix

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

                          func (n *NginxPlus) updateCharts() {
                              const notSeenLimit = 3
                          
                              for key, v := range n.cache.httpCaches {
                                  if v.updated && !v.hasCharts {
                          Severity: Minor
                          Found in src/go/plugin/go.d/modules/nginxplus/collect.go - About 1 day 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 Postgres.collectMetrics has 274 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (p *Postgres) collectMetrics(mx map[string]int64) {
                              mx["server_connections_used"] = p.mx.connUsed
                              if p.mx.maxConnections > 0 {
                                  mx["server_connections_available"] = p.mx.maxConnections - p.mx.connUsed
                                  mx["server_connections_utilization"] = calcPercentage(p.mx.connUsed, p.mx.maxConnections)
                          Severity: Major
                          Found in src/go/plugin/go.d/modules/postgres/collect_metrics.go - About 1 day to fix

                            File constructor.py has 581 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            # SPDX-License-Identifier: MIT
                            
                            __all__ = ['BaseConstructor', 'SafeConstructor', 'Constructor',
                                'ConstructorError']
                            
                            
                            Severity: Major
                            Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py - About 1 day to fix

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

                              // SPDX-License-Identifier: GPL-3.0-or-later
                              
                              package envoy
                              
                              import (
                              Severity: Major
                              Found in src/go/plugin/go.d/modules/envoy/charts.go - About 1 day to fix

                                Method Postgres.collectMetrics has a Cognitive Complexity of 77 (exceeds 20 allowed). Consider refactoring.
                                Open

                                func (p *Postgres) collectMetrics(mx map[string]int64) {
                                    mx["server_connections_used"] = p.mx.connUsed
                                    if p.mx.maxConnections > 0 {
                                        mx["server_connections_available"] = p.mx.maxConnections - p.mx.connUsed
                                        mx["server_connections_utilization"] = calcPercentage(p.mx.connUsed, p.mx.maxConnections)
                                Severity: Minor
                                Found in src/go/plugin/go.d/modules/postgres/collect_metrics.go - About 1 day 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 charts.go has 814 lines of code (exceeds 500 allowed). Consider refactoring.
                                Open

                                // SPDX-License-Identifier: GPL-3.0-or-later
                                
                                package weblog
                                
                                import (
                                Severity: Major
                                Found in src/go/plugin/go.d/modules/weblog/charts.go - About 1 day to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language