netdata/netdata

View on GitHub

Showing 1,245 of 2,987 total issues

Function parse_node has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_node(self, block=False, indentless_sequence=False):
        if self.check_token(AliasToken):
            token = self.get_token()
            event = AliasEvent(token.value, token.start_mark, token.end_mark)
            self.state = self.states.pop()
Severity: Minor
Found in src/collectors/python.d.plugin/python_modules/pyyaml2/parser.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 bindings.py has 494 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# SPDX-License-Identifier: MIT
"""
This module uses ctypes to bind a whole bunch of functions and constants from
SecureTransport. The goal here is to provide the low-level API to
SecureTransport. These are essentially the C-level functions and constants, and

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

    // SPDX-License-Identifier: GPL-3.0-or-later
    
    package k8s_state
    
    import (
    Severity: Minor
    Found in src/go/collectors/go.d.plugin/modules/k8s_state/charts.go - About 7 hrs to fix

      Function write_double_quoted has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
      Open

          def write_double_quoted(self, text, split=True):
              self.write_indicator('"', True)
              start = end = 0
              while end <= len(text):
                  ch = None
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml3/emitter.py - About 7 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 write_double_quoted has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
      Open

          def write_double_quoted(self, text, split=True):
              self.write_indicator(u'"', True)
              start = end = 0
              while end <= len(text):
                  ch = None
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 7 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 print_ has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
      Open

          def print_(*args, **kwargs):
              """The new-style print function for Python 2.4 and 2.5."""
              fp = kwargs.pop("file", sys.stdout)
              if fp is None:
                  return
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/urllib3/packages/six.py - About 7 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.collectMSSQL has 207 lines of code (exceeds 50 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: Major
      Found in src/go/collectors/go.d.plugin/modules/windows/collect_mssql.go - About 7 hrs to fix

        Function headMain has 181 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function headMain(os, charts, duration) {
            void (os);
        
            if (urlOptions.mode === 'print') {
                return '';
        Severity: Major
        Found in src/web/gui/main.js - About 7 hrs to fix

          logLine has 51 methods (exceeds 20 allowed). Consider refactoring.
          Open

              logLine struct {
                  web
                  custom custom
              }
          Severity: Major
          Found in src/go/collectors/go.d.plugin/modules/weblog/logline.go - About 7 hrs to fix

            File dashboard-react.js has 453 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* eslint-disable */
            
            /**
             *  after react-dashboard refractor, this file can be renamed to 'dashboard.js'
             *  and it will:
            Severity: Minor
            Found in src/web/gui/v1/dashboard-react.js - About 6 hrs to fix

              File response.py has 452 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # SPDX-License-Identifier: MIT
              from __future__ import absolute_import
              from contextlib import contextmanager
              import zlib
              import io
              Severity: Minor
              Found in src/collectors/python.d.plugin/python_modules/urllib3/response.py - About 6 hrs to fix

                File selectors.py has 448 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # SPDX-License-Identifier: MIT
                # Backport of selectors.py from Python 3.5+ to support Python < 3.4
                # Also has the behavior specified in PEP 475 which is to retry syscalls
                # in the case of an EINTR error. This module is required because selectors34
                # does not follow this behavior and instead returns that no dile descriptor

                  File queries.go has 693 lines of code (exceeds 500 allowed). Consider refactoring.
                  Open

                  // SPDX-License-Identifier: GPL-3.0-or-later
                  
                  package postgres
                  
                  func queryServerVersion() string {
                  Severity: Minor
                  Found in src/go/collectors/go.d.plugin/modules/postgres/queries.go - About 6 hrs to fix

                    Function saveSnapshot has 164 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function saveSnapshot() {
                        loadPako(function () {
                            loadLzString(function () {
                                saveSnapshotStop = false;
                                $('#saveSnapshotModalProgressSection').show();
                    Severity: Major
                    Found in src/web/gui/main.js - About 6 hrs to fix

                      Function renderPage has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function renderPage(menus, data) {
                          var div = document.getElementById('charts_div');
                          var pcent_width = Math.floor(100 / chartsPerRow($(div).width()));
                      
                          // find the proper duration for per-second updates
                      Severity: Minor
                      Found in src/web/gui/main.js - About 6 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 charts.go has 683 lines of code (exceeds 500 allowed). Consider refactoring.
                      Open

                      // SPDX-License-Identifier: GPL-3.0-or-later
                      
                      package proxysql
                      
                      import (
                      Severity: Minor
                      Found in src/go/collectors/go.d.plugin/modules/proxysql/charts.go - About 6 hrs to fix

                        Function enrichChartData has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function enrichChartData(chart) {
                            var parts = chart.type.split('_');
                            var tmp = parts[0];
                        
                            switch (tmp) {
                        Severity: Minor
                        Found in src/web/gui/main.js - About 6 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 dashboardSettingsSetup has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function dashboardSettingsSetup() {
                            var update_options_modal = function () {
                                // console.log('update_options_modal');
                        
                                var sync_option = function (option) {
                        Severity: Minor
                        Found in src/web/gui/main.js - About 6 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 charting.js has 427 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        
                        // Charts Libraries Registration
                        
                        NETDATA.chartLibraries = {
                            "dygraph": {
                        Severity: Minor
                        Found in src/web/gui/src/dashboard.js/charting.js - About 6 hrs to fix

                          Function d3pieChartCreate has 156 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          NETDATA.d3pieChartCreate = function (state, data) {
                          
                              state.element_chart.id = 'd3pie-' + state.uuid;
                              // console.log('id = ' + state.element_chart.id);
                          
                          
                          Severity: Major
                          Found in src/web/gui/src/dashboard.js/charting/d3pie.js - About 6 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language