Showing 124 of 4,610 total issues
DoorPi
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class DoorPi(object):
__metaclass__ = Singleton
__prepared = False
Function build_security_object
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def build_security_object(self, username, password, remote_client = ''):
if not len(self.config.get_keys('User')):
self.config.set_value(section = 'User', key = 'door', value = 'pi', password = True)
self.config.set_value(section = 'Group', key = 'administrator', value = 'door')
self.config.set_value(section = 'WritePermission', key = 'administrator', value = 'installer')
- 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
LinPhone
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class LinPhone(SipphoneAbstractBaseClass):
@property
def name(self): return 'linphone wrapper'
Function prepare
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def prepare(self, parsed_arguments):
logger.debug("prepare")
logger.debug("given arguments argv: %s", parsed_arguments)
self.__config = ConfigObject.load_config(parsed_arguments.configfile)
- 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
ConfigObject
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class ConfigObject():
__sections = {}
_config_file = None
Function check_module_status
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def check_module_status(module):
module['is_fulfilled'] = False if module['fulfilled_with_one'] else True
for module_name in module['libraries'].keys():
status = {}
try:
- 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 16 (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'] = ['']
return_dict = {}
- 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 bootstrap
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def bootstrap(tmpdir=None):
# Import pip so we can use it to install pip and maybe setuptools too
import pip
from pip.commands.install import InstallCommand
- 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 a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, input_pins, output_pins, conf_pre, conf_post, keyboard_name,
bouncetime=200, polarity=0, pressed_on_key_down=True, *args, **kwargs):
logger.debug("__init__(input_pins = %s, output_pins = %s, bouncetime = %s, polarity = %s)",
input_pins, output_pins, bouncetime, polarity)
self.keyboard_name = 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 read_usb_plain
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def read_usb_plain(self):
self._last_received_chars = ""
while not self._shutdown and self._ser.isOpen():
# char aus buffer holen
- 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 a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_string(self, section, key, default = '', log = True, password = False, store_if_not_exists = True):
value = None
try:
old_section, old_key = BACKWARD_COMPATIBILITY_KEYS[section][key]
value = self.__sections[old_section][old_key]
- 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 return_virtual_resource
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def return_virtual_resource(self, prepared_object, return_type = 'json'):
if isinstance(return_type, list) and len(return_type) > 0: return_type = return_type[0]
if return_type in ["json", "default"]:
return self.return_message(json.dumps(prepared_object), "application/json; charset=utf-8")
- 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 call
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def call(self, number):
DoorPi().event_handler('BeforeSipPhoneMakeCall', __name__, {'number':number})
logger.debug("call (%s)",str(number))
if not self.current_call:
logger.debug('no current call -> start new call')
- 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 ips_rpc_set_value
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def ips_rpc_set_value(key, value, config = None):
try:
if config is None: config = ips_rpc_create_config()
if ips_rpc_check_variable_exists(key, config) is not True: raise Exception("var %s doesn't exist", key)
type = ips_rpc_get_variable_type(key, config)
- 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 authentication_required
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def authentication_required(self):
parsed_path = urlparse(self.path)
public_resources = self.conf.get_keys(self.server.area_public_name, log = False)
for public_resource in public_resources:
- 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 is_admin_number
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def is_admin_number(self, remote_uri = None):
logger.debug("is_admin_number (%s)",remote_uri)
if remote_uri is None:
if self.current_call is not None:
- 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 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, input_pins, output_pins, conf_pre, conf_post, keyboard_name,
Function fire_action_mail
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def fire_action_mail(smtp_to, smtp_subject, smtp_text, smtp_snapshot):
try:
smtp_host = doorpi.DoorPi().config.get('SMTP', 'server', 'smtp.gmail.com')
smtp_port = doorpi.DoorPi().config.get_int('SMTP', 'port', 465)
smtp_user = doorpi.DoorPi().config.get('SMTP', 'username')
- 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 call
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def call(self, number):
DoorPi().event_handler('BeforeSipPhoneMakeCall', __name__, {'number':number})
logger.debug("call(%s)",str(number))
self.lib.thread_register('call_theard')
- 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 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get(parameters):
parameter_list = parameters.split(',')
if len(parameter_list) is not 1: return None
last_tick = parameter_list[0]