Showing 100 of 4,610 total issues
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
Function register_event
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def register_event(self, event_name, event_source):
silent = ONTIME in event_name
if not silent: logger.trace("register Event %s from %s ", event_name, event_source)
self.register_source(event_source)
if event_name not in self.__Events:
- Read upRead up
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 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, input_pins, output_pins, keyboard_name, bouncetime,
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, input_pins, output_pins, conf_pre, conf_post, keyboard_name, polarity = 0, *args, **kwargs):
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, input_pins, output_pins, keyboard_name, conf_pre, conf_post, bouncetime, *args, **kwargs):
Function __init__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, config_keyboards):
self.__OutputMappingTable = {}
self.__keyboards = {}
for keyboard_name in config_keyboards:
logger.info("trying to add keyboard '%s' to handler", keyboard_name)
- Read upRead up
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 self_check
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self_check(self, *args, **kwargs):
self.lib.thread_register('pjsip_handle_events')
self.lib.handle_events(self.call_timeout)
- Read upRead up
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_value
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_value(self, section, key, value, log = True, password = False):
if section not in self.__sections.keys():
self.__sections[section] = {}
password_friendly_value = "*******" if key is 'password' or password else value
- Read upRead up
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 9 (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'] = ['']
- Read upRead up
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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, input_pins, output_pins, conf_pre, conf_post, keyboard_name, *args, **kwargs):
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, input_pins, output_pins, keyboard_name, bouncetime = 200, polarity = 0, *args, **kwargs):
Avoid deeply nested control flow statements. Open
if now - self.last_key_time > self.__dismisstime:
doorpi.DoorPi().event_handler('OnFoundTag', __name__)
self.last_key = int(chars[5:-3], 16)
self.last_key_time = now
logger.debug("key is %s", self.last_key)
Avoid deeply nested control flow statements. Open
if value_requested in input_pin:
status['input'][input_pin] = keyboard.status_input(input_pin)
Function unregister_source
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def unregister_source(self, event_source, force_unregister = False):
try:
logger.trace("unregister Eventsource %s and force_unregister is %s", event_source, force_unregister)
if event_source not in self.__Sources: return "event_source %s unknown" % (event_source)
for event_name in self.__Events.keys():
- Read upRead up
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_keys
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_keys(self, section, filter = '', log = True):
return_list = []
if section not in self.__sections:
logging.warning("section %s not found in configfile", section)
else:
- Read upRead up
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 save_config
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def save_config(self, configfile = ''):
if not configfile: configfile = self.config_file
if not configfile: configfile = self.find_config(configfile)
if not configfile: configfile = doorpi.DoorPi().parse_string(os.path.join('!BASEPATH!', 'conf', 'doorpi.ini'))
- Read upRead up
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 deeply nested control flow statements. Open
if value_requested not in output_pin:
del status['output'][output_pin]
return status
Function collect_status
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def collect_status(self, DoorPiObject, modules = MODULES, value = list(), name = list()):
if len(modules) == 0: modules = MODULES
for module in modules:
if module not in MODULES:
- Read upRead up
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 self_check
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self_check(self, *args, **kwargs):
if not self.core: return
self.core.iterate()
- Read upRead up
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_string
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_string(self, section, key, default = '', log = True, password = False, store_if_not_exists = True):