motom001/DoorPi

View on GitHub

Showing 124 of 4,610 total issues

Function get has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def get(parameters):
    parameter_list = parameters.split(',')
    if len(parameter_list) is not 1: return None

    last_tick = parameter_list[0]
Severity: Minor
Found in doorpi/action/SingleActions/time_tick.py - About 1 hr to fix

    Function register_event has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def register_event(self, event_name, event_source):
            silent = ONTIME in event_name
            if not silent: logger.trace("register Event %s from %s ", event_name, event_source)
            self.register_source(event_source)
            if event_name not in self.__Events:
    Severity: Minor
    Found in doorpi/action/handler.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 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, input_pins, output_pins, keyboard_name, conf_pre, conf_post, bouncetime, *args, **kwargs):
    Severity: Major
    Found in doorpi/keyboard/from_pn532.py - About 1 hr to fix

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

          def __init__(self, input_pins, output_pins, keyboard_name, bouncetime,
      Severity: Major
      Found in doorpi/keyboard/from_piface.py - About 1 hr to fix

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

            def __init__(self, input_pins, output_pins, conf_pre, conf_post, keyboard_name, polarity = 0, *args, **kwargs):
        Severity: Major
        Found in doorpi/keyboard/from_filesystem.py - About 1 hr to fix

          Function self_check has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def self_check(self, *args, **kwargs):
                  self.lib.thread_register('pjsip_handle_events')
          
                  self.lib.handle_events(self.call_timeout)
          
          
          Severity: Minor
          Found in doorpi/sipphone/from_pjsua.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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, config_keyboards):
                  self.__OutputMappingTable = {}
                  self.__keyboards = {}
                  for keyboard_name in config_keyboards:
                      logger.info("trying to add keyboard '%s' to handler", keyboard_name)
          Severity: Minor
          Found in doorpi/keyboard/KeyboardInterface.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 set_value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def set_value(self, section, key, value, log = True, password = False):
                  if section not in self.__sections.keys():
                      self.__sections[section] = {}
          
                  password_friendly_value = "*******" if key is 'password' or password else value
          Severity: Minor
          Found in doorpi/conf/config_object.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 get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def get(*args, **kwargs):
              try:
                  if len(kwargs['name']) == 0: kwargs['name'] = ['']
                  if len(kwargs['value']) == 0: kwargs['value'] = ['']
          
          
          Severity: Minor
          Found in doorpi/status/status_lib/environment.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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, input_pins, output_pins, conf_pre, conf_post, keyboard_name, *args, **kwargs):
          Severity: Major
          Found in doorpi/keyboard/from_usb_plain.py - About 50 mins to fix

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

                def __init__(self, input_pins, output_pins, keyboard_name, bouncetime = 200, polarity = 0, *args, **kwargs):
            Severity: Major
            Found in doorpi/keyboard/from_dummy.py - About 50 mins to fix

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

                  def unregister_source(self, event_source, force_unregister = False):
                      try:
                          logger.trace("unregister Eventsource %s and force_unregister is %s", event_source, force_unregister)
                          if event_source not in self.__Sources: return "event_source %s unknown" % (event_source)
                          for event_name in self.__Events.keys():
              Severity: Minor
              Found in doorpi/action/handler.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 save_config has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def save_config(self, configfile = ''):
                      if not configfile: configfile = self.config_file
                      if not configfile: configfile = self.find_config(configfile)
                      if not configfile: configfile = doorpi.DoorPi().parse_string(os.path.join('!BASEPATH!', 'conf', 'doorpi.ini'))
              
              
              Severity: Minor
              Found in doorpi/conf/config_object.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 self_check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def self_check(self, *args, **kwargs):
                      if not self.core: return
              
                      self.core.iterate()
              
              
              Severity: Minor
              Found in doorpi/sipphone/from_linphone.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 get_string has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def get_string(self, section, key, default = '', log = True, password = False, store_if_not_exists = True):
              Severity: Minor
              Found in doorpi/conf/config_object.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if value_requested in input_pin:
                                            status['input'][input_pin] = keyboard.status_input(input_pin)
                
                
                Severity: Major
                Found in doorpi/status/status_lib/keyboard.py - About 45 mins to fix

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

                      def get_list(self, section, key, default = [], separator = ',', log = True, store_if_not_exists = True):
                  Severity: Minor
                  Found in doorpi/conf/config_object.py - About 45 mins to fix

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

                        def collect_status(self, DoorPiObject, modules = MODULES, value = list(), name = list()):
                            if len(modules) == 0: modules = MODULES
                    
                            for module in modules:
                                if module not in MODULES:
                    Severity: Minor
                    Found in doorpi/status/status_class.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 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(self, input_pins, keyboard_name, conf_pre, conf_post, *args, **kwargs):
                    Severity: Minor
                    Found in doorpi/keyboard/from_rdm6300.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if now - self.last_key_time > self.__dismisstime:
                                                      doorpi.DoorPi().event_handler('OnFoundTag', __name__)
                                                      self.last_key = int(chars[5:-3], 16)
                                                      self.last_key_time = now
                                                      logger.debug("key is %s", self.last_key)
                      Severity: Major
                      Found in doorpi/keyboard/from_rdm6300.py - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language