motom001/DoorPi

View on GitHub

Showing 100 of 201 total issues

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

        def rename_key(self, section, old_key, new_key, default = '', log = True):
    Severity: Minor
    Found in doorpi/conf/config_object.py - About 35 mins to fix

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

      def out_triggered(pin, start_value, end_value, timeout, stop_pin):
      Severity: Minor
      Found in doorpi/action/SingleActions/out_triggered.py - About 35 mins to fix

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

            def set_value(self, section, key, value, log = True, password = False):
        Severity: Minor
        Found in doorpi/conf/config_object.py - About 35 mins to fix

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

              def get_float(self, section, key, default = -1, log = True, store_if_not_exists = True):
          Severity: Minor
          Found in doorpi/conf/config_object.py - About 35 mins to fix

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

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

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

                  def insert_event_log(self, event_id, fired_by, event_name, start_time, additional_infos):
              Severity: Minor
              Found in doorpi/action/handler.py - About 35 mins to fix

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

                    def get_integer(self, section, key, default = -1, log = True, store_if_not_exists = True):
                Severity: Minor
                Found in doorpi/conf/config_object.py - About 35 mins to fix

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

                      def create_virtual_resource(self, path, raw_parameters):
                          return_object = {}
                          try:
                              if path.path == '/mirror':
                                  return_object = self.create_mirror()
                  Severity: Minor
                  Found in doorpi/status/webserver_lib/request_handler.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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def run(self, silent_mode = False):
                          if not silent_mode:
                              logger.trace('run %s with args %s and kwargs %s',
                                           self.__class__.__name__,
                                           self.__args,
                  Severity: Minor
                  Found in doorpi/action/base.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_as_daemon has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def main_as_daemon(argv):
                      if argv[1] is 'reload':
                          print('not implemeted yet - use restart instead')
                          return 1
                      if argv[1] in ['stop']:
                  Severity: Minor
                  Found in doorpi/main.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 is_admin_number has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def is_admin_number(self, remote_uri):
                          logger.debug("is_admin_number (%s)",remote_uri)
                          for admin_number in self.whitelist:
                              if admin_number == "*":
                                  logger.info("admin numbers are deactivated by using '*' as single number")
                  Severity: Minor
                  Found in doorpi/sipphone/linphone_lib/CallBacks.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 register_action has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def register_action(self, event_name, action_object, *args, **kwargs):
                          if ismethod(action_object) and callable(action_object):
                              action_object = SingleAction(action_object, *args, **kwargs)
                          elif isfunction(action_object) and callable(action_object):
                              action_object = SingleAction(action_object, *args, **kwargs)
                  Severity: Minor
                  Found in doorpi/action/handler.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 events_by_source has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def events_by_source(self):
                          events_by_source = {}
                          for event in self.events:
                              for source in self.events[event]:
                                  if source in events_by_source:
                  Severity: Minor
                  Found in doorpi/action/handler.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 get_from_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def get_from_config(self, config, log = True):
                          if log: logger.trace("get_from_config")
                          for section in config.sections():
                              self.__sections[section] = {}
                              for key, value in config.items(section):
                  Severity: Minor
                  Found in doorpi/conf/config_object.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 on_modified has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def on_modified(self, event):
                          if 'FileModifiedEvent' not in str(event): return
                          if self.__reset_file:
                              if self.__reset_file == event.src_path:
                                  self.__reset_file = None
                  Severity: Minor
                  Found in doorpi/keyboard/from_filesystem.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 on_incoming_call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def on_incoming_call(self, call):
                          # SIP-Status-Codes: http://de.wikipedia.org/wiki/SIP-Status-Codes
                          # 200 = OK
                          # 401 = Unauthorized
                          # 403 = Forbidden
                  Severity: Minor
                  Found in doorpi/sipphone/pjsua_lib/SipPhoneAccountCallBack.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

                  Avoid too many return statements within this function.
                  Open

                          return True
                  Severity: Major
                  Found in doorpi/action/handler.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                try:    return self.return_message(repr(prepared_object))
                    Severity: Major
                    Found in doorpi/status/webserver_lib/request_handler.py - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language