motom001/DoorPi

View on GitHub

Showing 100 of 4,610 total issues

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

    Avoid too many return statements within this function.
    Open

                except: return self.return_message(str(prepared_object))
    Severity: Major
    Found in doorpi/status/webserver_lib/request_handler.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return True
      Severity: Major
      Found in doorpi/status/webserver_lib/request_handler.py - About 30 mins to fix

        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

                          return
          Severity: Major
          Found in doorpi/sipphone/linphone_lib/CallBacks.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return self.return_message(prepared_object, 'text/html; charset=utf-8')
            Severity: Major
            Found in doorpi/status/webserver_lib/request_handler.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

                                return False
                Severity: Major
                Found in doorpi/status/webserver_lib/request_handler.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return self.return_message(str(prepared_object))
                  Severity: Major
                  Found in doorpi/status/webserver_lib/request_handler.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return False
                    Severity: Major
                    Found in doorpi/sipphone/from_pjsua.py - About 30 mins to fix

                      Function run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def run(self):
                              logger.debug("run")
                              if not self.__prepared: self.prepare(self.__parsed_arguments)
                      
                              self.event_handler.fire_event('BeforeStartup', __name__)
                      Severity: Minor
                      Found in doorpi/doorpi.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 event_detect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def event_detect(self, pin):
                              if self.status_input(pin):
                                  self._fire_OnKeyDown(pin, __name__)
                                  if self._pressed_on_key_down:  # issue 134
                                      self._fire_OnKeyPressed(pin, __name__)
                      Severity: Minor
                      Found in doorpi/keyboard/from_gpio.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 sound_devices has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def sound_devices(self):
                              try:
                                  all_devices = []
                                  for sound_device in self.lib.enum_snd_dev():
                                      all_devices.append({
                      Severity: Minor
                      Found in doorpi/sipphone/from_pjsua.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __init__(self, input_pins, output_pins, conf_pre, conf_post, keyboard_name, polarity = 0, *args, **kwargs):
                              logger.debug("FileSystem.__init__(input_pins = %s, output_pins = %s, polarity = %s)",
                                           input_pins, output_pins, polarity)
                              self.keyboard_name = keyboard_name
                              self._polarity = polarity
                      Severity: Minor
                      Found in doorpi/keyboard/from_filesystem.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 event_detect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def event_detect(self, event):
                              if self.status_input(event.pin_num):
                                  self._fire_OnKeyDown(event.pin_num, __name__)
                                  if self._pressed_on_key_down:  # issue 134
                                      self._fire_OnKeyPressed(event.pin_num, __name__)
                      Severity: Minor
                      Found in doorpi/keyboard/from_piface.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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def get(*args, **kwargs):
                          files = dict()
                          try:
                              if len(kwargs['name']) == 0: kwargs['name'] = ['']
                              if len(kwargs['value']) == 0: kwargs['value'] = ['']
                      Severity: Minor
                      Found in doorpi/status/status_lib/history_snapshot.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 list_directory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def list_directory(self, path):
                              dirs = []
                              files = []
                              for item in os.listdir(path):
                                  if os.path.isfile(item): files.append(item)
                      Severity: Minor
                      Found in doorpi/status/webserver_lib/request_handler.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 set_output has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def set_output(self, pin, value, log_output = True):
                              if self._ser and self._ser.isOpen():
                                  if log_output: logger.debug('try to write %s to serial usb plain', pin)
                                  self._ser.flushOutput()
                                  self._ser.write(pin + self._output_stop_flag)
                      Severity: Minor
                      Found in doorpi/keyboard/from_usb_plain.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 delete_section has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def delete_section(self, section, delete_empty_only = True, log = True):
                              if section in self.__sections and len(self.__sections[section]) > 0 and delete_empty_only:
                                  logger.warning("could not delete section %s, because it's not empty.", section)
                                  return False
                      
                      
                      Severity: Minor
                      Found in doorpi/conf/config_object.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 on_state has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def on_state(self):
                              logger.debug("on_state (%s)", self.call.info().state_text)
                              DoorPi().event_handler('OnCallStateChange', __name__, {
                                  'remote_uri': self.call.info().remote_uri,
                                  'state': self.call.info().state_text
                      Severity: Minor
                      Found in doorpi/sipphone/pjsua_lib/SipPhoneCallCallBack.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