motom001/DoorPi

View on GitHub

Showing 4,610 of 4,610 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class PlayerAbstractBaseClass(object):
    
        def __init__(self): raise NotImplementedError("Subclass %s should implement this!"%self.__class__.__name__)
        def config(self, **kwargs): raise NotImplementedError("Subclass %s should implement this!"%self.__class__.__name__)
        def start(self): raise NotImplementedError("Subclass %s should implement this!"%self.__class__.__name__)
    Severity: Major
    Found in doorpi/sipphone/AbstractBaseClass.py and 1 other location - About 1 day to fix
    doorpi/sipphone/AbstractBaseClass.py on lines 45..52

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 132.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class RecorderAbstractBaseClass(object):
    
        def __init__(self): raise NotImplementedError("Subclass %s should implement this!"%self.__class__.__name__)
        def config(self, **kwargs): raise NotImplementedError("Subclass %s should implement this!"%self.__class__.__name__)
        def start(self): raise NotImplementedError("Subclass %s should implement this!"%self.__class__.__name__)
    Severity: Major
    Found in doorpi/sipphone/AbstractBaseClass.py and 1 other location - About 1 day to fix
    doorpi/sipphone/AbstractBaseClass.py on lines 54..61

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 132.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    def ips_rpc_create_config():
        config = {}
        config['webservice_url'] = doorpi.DoorPi().config.get('IP-Symcon', 'server')
        config['username'] = doorpi.DoorPi().config.get('IP-Symcon', 'username')
        config['password'] = doorpi.DoorPi().config.get('IP-Symcon', 'password')
    Severity: Major
    Found in doorpi/action/SingleActions/ipsrpc_call_value.py and 1 other location - About 1 day to fix
    doorpi/action/SingleActions/ipsrpc_setvalue.py on lines 14..21

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 124.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    def ips_rpc_create_config():
        config = {}
        config['webservice_url'] = doorpi.DoorPi().config.get('IP-Symcon', 'server')
        config['username'] = doorpi.DoorPi().config.get('IP-Symcon', 'username')
        config['password'] = doorpi.DoorPi().config.get('IP-Symcon', 'password')
    Severity: Major
    Found in doorpi/action/SingleActions/ipsrpc_setvalue.py and 1 other location - About 1 day to fix
    doorpi/action/SingleActions/ipsrpc_call_value.py on lines 14..21

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 124.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            'serial': dict(
                text_warning =          '',
                text_description =      '''
    Hier die Beschreibung aus der <a href="https://github.com/motom001/DoorPi/blob/master/doorpi/keyboard/from_rdm6300.py">from_rdm6300.py</a>, die <a href="https://github.com/msmolny">msmolny</a> netterweise erstellt hat.
    
    
    Severity: Major
    Found in doorpi/status/requirements_lib/req_keyboard.py and 1 other location - About 6 hrs to fix
    doorpi/status/requirements_lib/req_keyboard.py on lines 218..234

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 99.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            'watchdog': dict(
                text_warning =          'Häufiges Lesen und Schreiben von SD-Karten wie im RPi können deren Verschleiß fördern. Eventuell sollte auf tmpfs Verzeichnisse ausgewichen werden.',
                text_description =      '''Das Python-Modul watchdog wird genutzt um ein dateibasierendes Keyboard zu erstellen.
    So können entweder zu Testzwecken ohne Hardware-Aufbau Events und Actions getestet werden oder es kann als Schnittstelle zu anderen Systemen dienen,
    die per SSH-Befehle die Dateien schreiben und lesen, die auch vom virtuellen keyboard verarbeitet werden.
    Severity: Major
    Found in doorpi/status/requirements_lib/req_keyboard.py and 1 other location - About 6 hrs to fix
    doorpi/status/requirements_lib/req_keyboard.py on lines 129..214

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 99.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def get_integer(self, section, key, default = -1, log = True, store_if_not_exists = True):
            value = self.get(section, key, str(default), log = False, store_if_not_exists = store_if_not_exists)
            if value is not '': value = int(value)
            else: value = default
            if log: logger.trace("get_integer for key %s in section %s (default: %s) returns %s", key, section, default, value)
    Severity: Major
    Found in doorpi/conf/config_object.py and 1 other location - About 4 hrs to fix
    doorpi/conf/config_object.py on lines 187..192

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 84.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def get_float(self, section, key, default = -1, log = True, store_if_not_exists = True):
            value = self.get_string(section, key, str(default), log = False, store_if_not_exists = store_if_not_exists)
            if value is not '': value = float(value)
            else: value = default
            if log: logger.trace("get_integer for key %s in section %s (default: %s) returns %s", key, section, default, value)
    Severity: Major
    Found in doorpi/conf/config_object.py and 1 other location - About 4 hrs to fix
    doorpi/conf/config_object.py on lines 194..199

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 84.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      def ips_rpc_fire(method, config, *parameters):
          payload = {
             "method": method,
             "params": parameters,
             "jsonrpc": config['jsonrpc'],
      Severity: Major
      Found in doorpi/action/SingleActions/ipsrpc_setvalue.py and 1 other location - About 4 hrs to fix
      doorpi/action/SingleActions/ipsrpc_call_value.py on lines 23..34

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 82.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      def ips_rpc_fire(method, config, *parameters):
          payload = {
             "method": method,
             "params": parameters,
             "jsonrpc": config['jsonrpc'],
      Severity: Major
      Found in doorpi/action/SingleActions/ipsrpc_call_value.py and 1 other location - About 4 hrs to fix
      doorpi/action/SingleActions/ipsrpc_setvalue.py on lines 23..34

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 82.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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 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

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

          if datetime_now.year != datetime_past.year:
              doorpi.DoorPi().event_handler('OnTimeYear', __name__)
              if datetime_now.year % 2 is 0: doorpi.DoorPi().event_handler('OnTimeYearEvenNumber', __name__)
              else: doorpi.DoorPi().event_handler('OnTimeYearUnevenNumber', __name__)
      Severity: Major
      Found in doorpi/action/SingleActions/time_tick.py and 3 other locations - About 4 hrs to fix
      doorpi/action/SingleActions/time_tick.py on lines 34..37
      doorpi/action/SingleActions/time_tick.py on lines 39..42
      doorpi/action/SingleActions/time_tick.py on lines 62..65

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 75.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Severity
      Category
      Status
      Source
      Language