motom001/DoorPi

View on GitHub

Showing 4,610 of 4,610 total issues

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

              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

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

                      if len(kwargs['value']) == 0: kwargs['value'] = ['']
              Severity: Major
              Found in doorpi/status/status_lib/sipphone.py and 15 other locations - About 35 mins to fix
              doorpi/status/status_lib/config.py on lines 10..10
              doorpi/status/status_lib/config.py on lines 11..11
              doorpi/status/status_lib/environment.py on lines 55..55
              doorpi/status/status_lib/environment.py on lines 56..56
              doorpi/status/status_lib/event_handler.py on lines 10..10
              doorpi/status/status_lib/event_handler.py on lines 11..11
              doorpi/status/status_lib/history_event.py on lines 10..10
              doorpi/status/status_lib/history_event.py on lines 11..11
              doorpi/status/status_lib/history_snapshot.py on lines 14..14
              doorpi/status/status_lib/history_snapshot.py on lines 15..15
              doorpi/status/status_lib/keyboard.py on lines 12..12
              doorpi/status/status_lib/keyboard.py on lines 13..13
              doorpi/status/status_lib/sipphone.py on lines 10..10
              doorpi/status/status_lib/webserver.py on lines 10..10
              doorpi/status/status_lib/webserver.py on lines 11..11

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

              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 16 locations. Consider refactoring.
              Open

                      if len(kwargs['value']) == 0: kwargs['value'] = ['']
              Severity: Major
              Found in doorpi/status/status_lib/history_event.py and 15 other locations - About 35 mins to fix
              doorpi/status/status_lib/config.py on lines 10..10
              doorpi/status/status_lib/config.py on lines 11..11
              doorpi/status/status_lib/environment.py on lines 55..55
              doorpi/status/status_lib/environment.py on lines 56..56
              doorpi/status/status_lib/event_handler.py on lines 10..10
              doorpi/status/status_lib/event_handler.py on lines 11..11
              doorpi/status/status_lib/history_event.py on lines 10..10
              doorpi/status/status_lib/history_snapshot.py on lines 14..14
              doorpi/status/status_lib/history_snapshot.py on lines 15..15
              doorpi/status/status_lib/keyboard.py on lines 12..12
              doorpi/status/status_lib/keyboard.py on lines 13..13
              doorpi/status/status_lib/sipphone.py on lines 10..10
              doorpi/status/status_lib/sipphone.py on lines 11..11
              doorpi/status/status_lib/webserver.py on lines 10..10
              doorpi/status/status_lib/webserver.py on lines 11..11

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

              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 16 locations. Consider refactoring.
              Open

                      if len(kwargs['value']) == 0: kwargs['value'] = ['']
              Severity: Major
              Found in doorpi/status/status_lib/webserver.py and 15 other locations - About 35 mins to fix
              doorpi/status/status_lib/config.py on lines 10..10
              doorpi/status/status_lib/config.py on lines 11..11
              doorpi/status/status_lib/environment.py on lines 55..55
              doorpi/status/status_lib/environment.py on lines 56..56
              doorpi/status/status_lib/event_handler.py on lines 10..10
              doorpi/status/status_lib/event_handler.py on lines 11..11
              doorpi/status/status_lib/history_event.py on lines 10..10
              doorpi/status/status_lib/history_event.py on lines 11..11
              doorpi/status/status_lib/history_snapshot.py on lines 14..14
              doorpi/status/status_lib/history_snapshot.py on lines 15..15
              doorpi/status/status_lib/keyboard.py on lines 12..12
              doorpi/status/status_lib/keyboard.py on lines 13..13
              doorpi/status/status_lib/sipphone.py on lines 10..10
              doorpi/status/status_lib/sipphone.py on lines 11..11
              doorpi/status/status_lib/webserver.py on lines 10..10

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

              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 16 locations. Consider refactoring.
              Open

                      if len(kwargs['name']) == 0: kwargs['name'] = ['']
              Severity: Major
              Found in doorpi/status/status_lib/config.py and 15 other locations - About 35 mins to fix
              doorpi/status/status_lib/config.py on lines 11..11
              doorpi/status/status_lib/environment.py on lines 55..55
              doorpi/status/status_lib/environment.py on lines 56..56
              doorpi/status/status_lib/event_handler.py on lines 10..10
              doorpi/status/status_lib/event_handler.py on lines 11..11
              doorpi/status/status_lib/history_event.py on lines 10..10
              doorpi/status/status_lib/history_event.py on lines 11..11
              doorpi/status/status_lib/history_snapshot.py on lines 14..14
              doorpi/status/status_lib/history_snapshot.py on lines 15..15
              doorpi/status/status_lib/keyboard.py on lines 12..12
              doorpi/status/status_lib/keyboard.py on lines 13..13
              doorpi/status/status_lib/sipphone.py on lines 10..10
              doorpi/status/status_lib/sipphone.py on lines 11..11
              doorpi/status/status_lib/webserver.py on lines 10..10
              doorpi/status/status_lib/webserver.py on lines 11..11

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

              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 16 locations. Consider refactoring.
              Open

                      if len(kwargs['value']) == 0: kwargs['value'] = ['']
              Severity: Major
              Found in doorpi/status/status_lib/config.py and 15 other locations - About 35 mins to fix
              doorpi/status/status_lib/config.py on lines 10..10
              doorpi/status/status_lib/environment.py on lines 55..55
              doorpi/status/status_lib/environment.py on lines 56..56
              doorpi/status/status_lib/event_handler.py on lines 10..10
              doorpi/status/status_lib/event_handler.py on lines 11..11
              doorpi/status/status_lib/history_event.py on lines 10..10
              doorpi/status/status_lib/history_event.py on lines 11..11
              doorpi/status/status_lib/history_snapshot.py on lines 14..14
              doorpi/status/status_lib/history_snapshot.py on lines 15..15
              doorpi/status/status_lib/keyboard.py on lines 12..12
              doorpi/status/status_lib/keyboard.py on lines 13..13
              doorpi/status/status_lib/sipphone.py on lines 10..10
              doorpi/status/status_lib/sipphone.py on lines 11..11
              doorpi/status/status_lib/webserver.py on lines 10..10
              doorpi/status/status_lib/webserver.py on lines 11..11

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

              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 16 locations. Consider refactoring.
              Open

                      if len(kwargs['name']) == 0: kwargs['name'] = ['']
              Severity: Major
              Found in doorpi/status/status_lib/webserver.py and 15 other locations - About 35 mins to fix
              doorpi/status/status_lib/config.py on lines 10..10
              doorpi/status/status_lib/config.py on lines 11..11
              doorpi/status/status_lib/environment.py on lines 55..55
              doorpi/status/status_lib/environment.py on lines 56..56
              doorpi/status/status_lib/event_handler.py on lines 10..10
              doorpi/status/status_lib/event_handler.py on lines 11..11
              doorpi/status/status_lib/history_event.py on lines 10..10
              doorpi/status/status_lib/history_event.py on lines 11..11
              doorpi/status/status_lib/history_snapshot.py on lines 14..14
              doorpi/status/status_lib/history_snapshot.py on lines 15..15
              doorpi/status/status_lib/keyboard.py on lines 12..12
              doorpi/status/status_lib/keyboard.py on lines 13..13
              doorpi/status/status_lib/sipphone.py on lines 10..10
              doorpi/status/status_lib/sipphone.py on lines 11..11
              doorpi/status/status_lib/webserver.py on lines 11..11

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

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

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

                      if len(kwargs['name']) == 0: kwargs['name'] = ['']
              Severity: Major
              Found in doorpi/status/status_lib/environment.py and 15 other locations - About 35 mins to fix
              doorpi/status/status_lib/config.py on lines 10..10
              doorpi/status/status_lib/config.py on lines 11..11
              doorpi/status/status_lib/environment.py on lines 56..56
              doorpi/status/status_lib/event_handler.py on lines 10..10
              doorpi/status/status_lib/event_handler.py on lines 11..11
              doorpi/status/status_lib/history_event.py on lines 10..10
              doorpi/status/status_lib/history_event.py on lines 11..11
              doorpi/status/status_lib/history_snapshot.py on lines 14..14
              doorpi/status/status_lib/history_snapshot.py on lines 15..15
              doorpi/status/status_lib/keyboard.py on lines 12..12
              doorpi/status/status_lib/keyboard.py on lines 13..13
              doorpi/status/status_lib/sipphone.py on lines 10..10
              doorpi/status/status_lib/sipphone.py on lines 11..11
              doorpi/status/status_lib/webserver.py on lines 10..10
              doorpi/status/status_lib/webserver.py on lines 11..11

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

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

              Severity
              Category
              Status
              Source
              Language