motom001/DoorPi

View on GitHub

Showing 100 of 201 total issues

File get_pip.py has 17487 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
#
# Hi There!
# You may be wondering what this giant blob of binary data here is, you might
# even be worried that we're up to something nefarious (good for you for being
Severity: Major
Found in get_pip.py - About 1 mo to fix

    Function get has a Cognitive Complexity of 45 (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/sipphone.py - About 6 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

    Function call_state_changed_handle has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        def call_state_changed_handle(self, core, call, call_state, message):
            logger.debug("call_state_changed (%s - %s)", call_state, message)
    
            remote_uri = call.remote_address.as_string_uri_only()
    
    
    Severity: Minor
    Found in doorpi/sipphone/linphone_lib/CallBacks.py - About 5 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

    Function time_tick has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

    def time_tick(last_tick):
    
        timestamp_now = time.time()
        timestamp_past = last_time_tick_second
    
    
    Severity: Minor
    Found in doorpi/action/SingleActions/time_tick.py - About 5 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

    Function get has a Cognitive Complexity of 34 (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/keyboard.py - About 5 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

    Function start has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

        def start(self):
            DoorPi().event_handler('OnSipPhoneCreate', __name__)
            self.core.max_calls = conf.get_int(SIPPHONE_SECTION, 'ua.max_calls', 2)
            self.core.echo_cancellation_enabled = conf.get_bool(SIPPHONE_SECTION, 'echo_cancellation_enabled', False)
            
    Severity: Minor
    Found in doorpi/sipphone/from_linphone.py - About 4 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 request_handler.py has 363 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    
    import logging
    logger = logging.getLogger(__name__)
    Severity: Minor
    Found in doorpi/status/webserver_lib/request_handler.py - About 4 hrs to fix

      Function readUART has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          def readUART(self):
              while not self._shutdown:
                  logger.debug("readUART() started")
                  # initialize UART
                  # make sure that terminal via UART is disabled
      Severity: Minor
      Found in doorpi/keyboard/from_rdm6300.py - About 4 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

      Function check_config has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

      def check_config(config):
          errors = []
          warnings = []
          infos = []
      
      
      Severity: Minor
      Found in doorpi/status/webserver.py - About 4 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

      Function fire_event_synchron has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          def fire_event_synchron(self, event_name, event_source, kwargs = None):
              silent = ONTIME in event_name
              if self.__destroy and not silent: return False
      
              event_fire_id = id_generator()
      Severity: Minor
      Found in doorpi/action/handler.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

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

          def parse_content(self, content, online_fallback = False, **mapping_table):
              try:
                  matches = re.findall(r"{([^}\s]*)}", content)
                  if not matches: return content
                  #http://stackoverflow.com/questions/12897374/get-unique-values-from-a-list-in-python/12897491#12897491
      Severity: Minor
      Found in doorpi/status/webserver_lib/request_handler.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

      Function b85decode has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def b85decode(b):
              _b85dec = [None] * 256
              for i, c in enumerate(iterbytes(_b85alphabet)):
                  _b85dec[c] = i
      
      
      Severity: Minor
      Found in get_pip.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

      LinphoneCallbacks has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class LinphoneCallbacks:
      
          @property
          def used_callbacks(self): return {
              #http://www.linphone.org/docs/liblinphone/struct__LinphoneCoreVTable.html
      Severity: Minor
      Found in doorpi/sipphone/linphone_lib/CallBacks.py - About 3 hrs to fix

        File handler.py has 303 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #!/usr/bin/env python
        # -*- coding: utf-8 -*-
        
        import logging
        logger = logging.getLogger(__name__)
        Severity: Minor
        Found in doorpi/action/handler.py - About 3 hrs to fix

          Function do_control has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

              def do_control(self, control_order, para):
                  result_object = dict(
                      success = False,
                      message = 'unknown error'
                  )
          Severity: Minor
          Found in doorpi/status/webserver_lib/request_handler.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

          Function get has a Cognitive Complexity of 23 (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/event_handler.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

          DoorPiWebRequestHandler has 26 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class DoorPiWebRequestHandler(BaseHTTPRequestHandler):
          
              @property
              def conf(self): return self.server.config
          
          
          Severity: Minor
          Found in doorpi/status/webserver_lib/request_handler.py - About 3 hrs to fix

            File from_linphone.py has 287 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            #!/usr/bin/env python
            # -*- coding: utf-8 -*-
            
            import logging
            logger = logging.getLogger(__name__)
            Severity: Minor
            Found in doorpi/sipphone/from_linphone.py - About 2 hrs to fix

              Function parse_string has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse_string(self, input_string):
                      parsed_string = datetime.datetime.now().strftime(str(input_string))
              
                      if self.keyboard is None or self.keyboard.last_key is None:
                          self.additional_informations['LastKey'] = "NotSetYet"
              Severity: Minor
              Found in doorpi/doorpi.py - About 2 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

              Function get has a Cognitive Complexity of 20 (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/webserver.py - About 2 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

              Severity
              Category
              Status
              Source
              Language