firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

File securetransport.py has 559 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# SPDX-License-Identifier: MIT
"""
SecureTranport support for urllib3 via ctypes.

This makes platform-native TLS available to urllib3 users on macOS without the

    Windows has 64 methods (exceeds 20 allowed). Consider refactoring.
    Open

    func (w *Windows) addCPUCharts() {
        charts := cpuCharts.Copy()
    
        if err := w.Charts().Add(*charts...); err != nil {
            w.Warning(err)
    Severity: Major
    Found in src/go/plugin/go.d/modules/windows/charts.go - About 1 day to fix

      Function write_single_quoted has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
      Open

          def write_single_quoted(self, text, split=True):
              self.write_indicator('\'', True)
              spaces = False
              breaks = False
              start = end = 0
      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 800 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      // SPDX-License-Identifier: GPL-3.0-or-later
      
      package cockroachdb
      
      import "github.com/netdata/netdata/go/plugins/plugin/go.d/agent/module"
      Severity: Major
      Found in src/go/plugin/go.d/modules/cockroachdb/charts.go - About 1 day to fix

        Function write_folded has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
        Open

            def write_folded(self, text):
                hints = self.determine_block_hints(text)
                self.write_indicator('>'+hints, True)
                if hints[-1:] == '+':
                    self.open_ended = True
        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 790 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

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

          Function _syscall_wrapper has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
          Open

              def _syscall_wrapper(func, recalc_timeout, *args, **kwargs):
                  """ Wrapper function for syscalls that could fail due to EINTR.
                  All functions should be retried if there is time left in the timeout
                  in accordance with PEP 475. """
                  timeout = kwargs.get("timeout", None)

          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

          Emitter has 59 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Emitter:
          
              DEFAULT_TAG_PREFIXES = {
                  '!' : '!',
                  'tag:yaml.org,2002:' : '!!',
          Severity: Major
          Found in src/collectors/python.d.plugin/python_modules/pyyaml3/emitter.py - About 1 day to fix

            Function write_plain has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
            Open

                def write_plain(self, text, split=True):
                    if self.root_context:
                        self.open_ended = True
                    if not text:
                        return
            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 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/pyyaml3/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/plugin/go.d/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 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

                Function build_readme_from_integration has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                Open

                def build_readme_from_integration(integration, mode=''):
                    # COLLECTORS
                    if mode == 'collector':
                
                        try:
                Severity: Minor
                Found in integrations/gen_docs_integrations.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/plugin/go.d/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

                    File dyncfg.go has 717 lines of code (exceeds 500 allowed). Consider refactoring.
                    Open

                    // SPDX-License-Identifier: GPL-3.0-or-later
                    
                    package jobmgr
                    
                    import (
                    Severity: Minor
                    Found in src/go/plugin/go.d/agent/jobmgr/dyncfg.go - 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/plugin/go.d/modules/weblog/logline.go - About 7 hrs to fix

                        File queries.go has 709 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/plugin/go.d/modules/postgres/queries.go - About 7 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language