motom001/DoorPi

View on GitHub
doorpi/sipphone/linphone_lib/CallBacks.py

Summary

Maintainability
C
1 day
Test Coverage

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

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

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

        def __init__(self):
            logger.debug("__init__")
    
            self._last_number_of_calls = 0
    
    
    Severity: Minor
    Found in doorpi/sipphone/linphone_lib/CallBacks.py - About 1 hr to fix

      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

      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

        There are no issues that match your filters.

        Category
        Status