netdata/netdata

View on GitHub

Showing 1,252 of 2,993 total issues

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 gen_integrations.py has 574 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

      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/collectors/go.d.plugin/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/collectors/go.d.plugin/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 constructor.py has 570 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/pyyaml2/constructor.py - About 1 day to fix

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

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

                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(u'\'', True)
                        spaces = False
                        breaks = False
                        start = end = 0
                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 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/go.d.plugin/agent/module"
                Severity: Major
                Found in src/go/collectors/go.d.plugin/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

                  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(u'>'+hints, True)
                          if hints[-1:] == u'+':
                              self.open_ended = True
                  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 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/collectors/go.d.plugin/modules/elasticsearch/charts.go - About 1 day to fix

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

                    # -*- coding: utf-8 -*-
                    # Description: nvidia-smi netdata python.d module
                    # Original Author: Steven Noonan (tycho)
                    # Author: Ilya Mashchenko (ilyam8)
                    # User Memory Stat Author: Guido Scatena (scatenag)
                    Severity: Major
                    Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py - 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

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

                        class Emitter(object):
                        
                            DEFAULT_TAG_PREFIXES = {
                                u'!' : u'!',
                                u'tag:yaml.org,2002:' : u'!!',
                        Severity: Major
                        Found in src/collectors/python.d.plugin/python_modules/pyyaml2/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 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/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

                          Severity
                          Category
                          Status
                          Source
                          Language