netdata/netdata

View on GitHub

Showing 1,252 of 2,993 total issues

File scanner.py has 882 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# SPDX-License-Identifier: MIT

# Scanner produces tokens of the following types:
# STREAM-START
# STREAM-END
Severity: Major
Found in src/collectors/python.d.plugin/python_modules/pyyaml3/scanner.py - About 2 days to fix

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

    func (w *Windows) collectMSSQL(mx map[string]int64, pms prometheus.Series) {
        instances := make(map[string]bool)
        dbs := make(map[string]bool)
        px := "mssql_instance_"
        for _, pm := range pms.FindByName(metricMSSQLAccessMethodPageSplits) {
    Severity: Minor
    Found in src/go/collectors/go.d.plugin/modules/windows/collect_mssql.go - About 2 days 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 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

      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

        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/collectors/go.d.plugin/modules/mongodb/charts.go - About 1 day to fix

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

            # -*- coding: utf-8 -*-
            # Description: oracledb netdata python.d module
            # Author: ilyam8 (Ilya Mashchenko)
            # SPDX-License-Identifier: GPL-3.0-or-later
            
            
            Severity: Major
            Found in src/collectors/python.d.plugin/oracledb/oracledb.chart.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

              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/pyyaml2/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 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/collectors/go.d.plugin/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

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

                        class Scanner(object):
                        
                            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/pyyaml2/scanner.py - About 1 day to fix

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

                          // SPDX-License-Identifier: GPL-3.0-or-later
                          
                          package vernemq
                          
                          import "github.com/netdata/netdata/go/go.d.plugin/agent/module"
                          Severity: Major
                          Found in src/go/collectors/go.d.plugin/modules/vernemq/charts.go - 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/collectors/go.d.plugin/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

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

                            # -*- coding: utf-8 -*-
                            # Description: smart netdata python.d module
                            # Author: ilyam8, vorph1
                            # SPDX-License-Identifier: GPL-3.0-or-later
                            
                            
                            Severity: Major
                            Found in src/collectors/python.d.plugin/smartd_log/smartd_log.chart.py - About 1 day to fix

                              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/collectors/go.d.plugin/modules/postgres/collect_metrics.go - About 1 day to fix
                                Severity
                                Category
                                Status
                                Source
                                Language