thenaterhood/heartbeat

View on GitHub

Showing 17 of 25 total issues

Function receive has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def receive(self, data, addr):
        """
        Receives the data and address from a broadcast. Used for the
        SocketListener to call back to when it receives something.

Severity: Minor
Found in src/heartbeat/pluggable/histamine.py - About 3 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 histamine.py has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Heartbeat plugins pertaining to Heartbeat's
Histamine system which allows events to be
sent over and received from the network.

Severity: Minor
Found in src/heartbeat/pluggable/histamine.py - About 3 hrs to fix

    File heartbeat.py has 266 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    Heartbeat's Heartbeat plugins
    """
    
    import datetime
    Severity: Minor
    Found in src/heartbeat/pluggable/heartbeat.py - About 2 hrs to fix

      Function __init__ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self):
              """
              constructor
      
              Params:
      Severity: Minor
      Found in src/heartbeat/pluggable/histamine.py - About 1 hr 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 __init__ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self):
      
              settings = get_config_manager()
              self.unacked = {}
              self.monitor_server = settings.heartbeat.monitor_server
      Severity: Minor
      Found in src/heartbeat/pluggable/histamine.py - About 1 hr 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 main has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def main():
          if (sys.version_info < (3, 3)):
              logger.error("Your Python version is older than 3.3. It is no longer officially supported!")
      
          logger.debug("Loading configuration")
      Severity: Minor
      Found in src/heartbeat/__main__.py - About 1 hr 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 from_json has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def from_json(jsonString):
              try:
                  dictionary = json.loads(jsonString)
              except Exception:
                  raise Exception('Malformed event JSON')
      Severity: Minor
      Found in src/heartbeat/platform/__init__.py - About 1 hr 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 run_check has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def run_check(self, callback):
              """
              Runs a SMART check on all the configured drives
              """
      
      
      Severity: Minor
      Found in src/heartbeat/pluggable/disks.py - About 55 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 activate_plugins has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def activate_plugins(self=None):
              """
              Instantiates all the plugins in the plugin registry
              """
              waiting_plugins = [x() for x in PluginRegistry.__plugins]
      Severity: Minor
      Found in src/heartbeat/plugin/__init__.py - About 55 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 update_dyndns has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_dyndns(self, event):
              if ('ip_type' in event.payload and event.payload['ip_type'] == 'WAN'):
      
                  ip = event.payload['ip']
                  if ip != self.current_ip or self.current_ip is None:
      Severity: Minor
      Found in src/heartbeat/pluggable/dyndns.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_event has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def send_event(self, event):
              """
              Sends an event
              """
              if ("histamine_rxtime" in event.payload):
      Severity: Minor
      Found in src/heartbeat/pluggable/histamine.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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, event_callback, threadpool, interval=60, logger=None, timer=None):
      Severity: Minor
      Found in src/heartbeat/monitoring/__init__.py - About 35 mins to fix

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

            def __init__(self, cache_name, reset=False, settings=None, encryptor=None, path=None):
        Severity: Minor
        Found in src/heartbeat/multiprocessing/__init__.py - About 35 mins to fix

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

              def __init__(self, port, callback, daemon=True, timeout=None, sock=socket.socket):
          Severity: Minor
          Found in src/heartbeat/network/__init__.py - About 35 mins to fix

            Function get_cache_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_cache_path(settings=None):
                if settings is None:
                    settings = get_config_manager()
            
                cache_path = settings.heartbeat.cache_dir
            Severity: Minor
            Found in src/heartbeat/platform/__init__.py - About 35 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 main has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def main():
                if len(sys.argv) == 1:
                    print_help()
                    sys.exit(1)
            
            
            Severity: Minor
            Found in src/heartbeat/hb_send.py - About 25 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 main has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def main():
                parser = argparse.ArgumentParser()
            
                if sys.platform == "win32":
                    default_path = os.path.join(os.environ['PROGRAMDATA'], 'Heartbeat')
            Severity: Minor
            Found in src/heartbeat/__install__.py - About 25 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

            Severity
            Category
            Status
            Source
            Language