firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, token_number, required, index, line, column, mark):
Severity: Minor
Found in src/collectors/python.d.plugin/python_modules/pyyaml3/scanner.py - About 45 mins to fix

    Function construct_yaml_float has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def construct_yaml_float(self, node):
            value = self.construct_scalar(node)
            value = value.replace('_', '').lower()
            sign = +1
            if value[0] == '-':
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py - About 45 mins 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

    Avoid deeply nested control flow statements.
    Open

                            if self.encoding:
                                data = data.encode(self.encoding)
                            self.stream.write(data)
    Severity: Major
    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/emitter.py - About 45 mins to fix

      Function represent_float has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def represent_float(self, data):
              if data != data or (data == 0.0 and data == 1.0):
                  value = '.nan'
              elif data == self.inf_value:
                  value = '.inf'
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml3/representer.py - About 45 mins 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

      Avoid deeply nested control flow statements.
      Open

                              if br == '\n':
                                  self.write_line_break()
                              else:
                                  self.write_line_break(br)
                          self.write_indent()
      Severity: Major
      Found in src/collectors/python.d.plugin/python_modules/pyyaml3/emitter.py - About 45 mins to fix

        Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, stream, canonical=None, indent=None, width=None,
        Severity: Minor
        Found in src/collectors/python.d.plugin/python_modules/pyyaml3/emitter.py - About 45 mins to fix

          Function _dnsname_match has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def _dnsname_match(dn, hostname, max_wildcards=1):
              """Matching according to RFC 6125, section 6.4.3
          
              http://tools.ietf.org/html/rfc6125#section-6.4.3
              """

          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 _connect2socket has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def _connect2socket(self, res=None):
                  """
                  Connect to a socket, passing the result of getaddrinfo()
                  :return: boolean
                  """

          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_data_ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def parse_data_(data):
              def is_backend(backend):
                  return backend.get('svname') == 'BACKEND' and backend.get('# pxname') != 'stats'
          
              def is_frontend(frontend):
          Severity: Minor
          Found in src/collectors/python.d.plugin/haproxy/haproxy.chart.py - About 45 mins 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 _send_until_done has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def _send_until_done(self, data):
                  while True:
                      try:
                          return self.connection.send(data)
                      except OpenSSL.SSL.WantWriteError:

          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 close has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def close(self):
                  # TODO: should I do clean shutdown here? Do I have to?
                  if self._makefile_refs < 1:
                      self._closed = True
                      if self.context:

          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 backport_makefile has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def backport_makefile(self, mode="r", buffering=None, encoding=None,

            Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, job_name, actual_job_name, priority, cleanup, get_update_every, module_name):
            Severity: Minor
            Found in src/collectors/python.d.plugin/python_modules/bases/charts.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if recalc_timeout:
                                          if "timeout" in kwargs:
                                              kwargs["timeout"] = expires - current_time
                                  continue
              Severity: Major
              Found in src/collectors/python.d.plugin/python_modules/urllib3/util/selectors.py - About 45 mins to fix

                Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(self, proxy_url, username=None, password=None,
                Severity: Minor
                Found in src/collectors/python.d.plugin/python_modules/urllib3/contrib/socks.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if _dnsname_match(value, hostname):
                                          return
                                      dnsnames.append(value)

                    Function create_charts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def create_charts(self):
                            for front in self.data['frontend']:
                                name, idx = front['# pxname'], front['# pxname'].replace('.', '_')
                                for metric in METRICS:
                                    self.definitions['f' + metric]['lines'].append(['_'.join(['frontend', metric, idx]),
                    Severity: Minor
                    Found in src/collectors/python.d.plugin/haproxy/haproxy.chart.py - About 45 mins 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 make_headers has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def make_headers(keep_alive=None, accept_encoding=None, user_agent=None,
                    Severity: Minor
                    Found in src/collectors/python.d.plugin/python_modules/urllib3/util/request.py - About 45 mins to fix

                      Function check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def check(self):
                              """ensure charts and dims all configured and that we can get data"""
                      
                              if not HAS_REQUESTS:
                                  self.warning('requests library could not be imported')
                      Severity: Minor
                      Found in src/collectors/python.d.plugin/pandas/pandas.chart.py - About 45 mins 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

                      Avoid deeply nested control flow statements.
                      Open

                                              if current_time > expires:
                                                  raise OSError(errno=errno.ETIMEDOUT)
                                              if recalc_timeout:
                      Severity: Major
                      Found in src/collectors/python.d.plugin/python_modules/urllib3/util/selectors.py - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language