Showing 9,400 of 17,590 total issues
Function vbd_list
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def vbd_list(name=None, call=None):
'''
Get a list of VBDs on a VM
**requires**: the name of the vm with the vbd definition
- 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 _list_linodes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _list_linodes(full=False):
'''
Helper function to format and parse linode data
'''
nodes = _query('linode', 'list')['DATA']
- 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 setting_size != vm_disk_size:
postParams = {}
postParams['disk'] = setting
postParams['size'] = setting_size
query('put', 'nodes/{0}/qemu/{1}/resize'.format(
Avoid deeply nested control flow statements. Open
if vmcfg['cpu_cap'] != '':
ret[vm]['resources']['cpu'] = "{0:.2f}".format(int(vmcfg['cpu_cap'])/100)
else:
Avoid deeply nested control flow statements. Open
if ipnet:
inet_ips = [
six.text_type(ip) for ip in ips if _ipnet_belongs(ip)
] # filter and get only IP include ipnet
if inet_ips: # if any
Avoid deeply nested control flow statements. Open
if base:
above.insert(0, base)
sroot = os.path.dirname(sroot)
Function top
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def top(**kwargs):
'''
Connect to a mongo database and read per-node tops data.
Parameters:
- 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 flush
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def flush(bank, key=None, cachedir=None):
'''
Remove the key from the cache bank with all the key content.
'''
if cachedir is 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
Avoid deeply nested control flow statements. Open
if kwargs and not _compare_match(kwargs, neighbor):
# requested filtering by neighbors stats
# but this one does not correspond
continue
if neighbor_ip and neighbor_ip != neighbor.get('remote_address'):
Function find
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find(path, saltenv='base'):
'''
Return a dict of the files located with the given path and environment
'''
# Return a list of paths + text or bin
- 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 not((ptl in rsn.lower()) or (ptl in rsd.lower()) or
(ptl in rpd.lower()) or (ptl in rci.lower())):
# nothing matched, let's move on
continue
if chassis:
Function delete_device
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def delete_device(name, safety_on=True):
'''
Deletes a device from Vistara based on DNS name or partial name. By default,
delete_device will only perform the delete if a single host is returned. Set
safety_on=False to delete all matches (up to default API search page size)
- 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 base:
above.insert(0, base)
sroot = os.path.dirname(sroot)
Avoid deeply nested control flow statements. Open
if host in ret:
ret[host].append(name)
else:
ret[host] = [name]
return ret
Avoid deeply nested control flow statements. Open
for pkgname, versions in six.iteritems(config):
log.debug(
'Compiling winrepo data for package \'%s\'',
pkgname
)
Avoid deeply nested control flow statements. Open
if display:
interf_entry['ips'] = '\n'.join(interf_entry['ips'])
if ipnet:
Function request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def request(
minion_id,
dns_name=None,
zone='default',
request_id=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 find
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find(path, saltenv='base'):
'''
Return a dict of the files located with the given path and environment
'''
# Return a list of paths + text or bin
- 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 delete_host
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def delete_host(zone, name, keyname, keyfile, nameserver, timeout, port=53,
keyalgorithm='hmac-md5'):
'''
Delete both forward (A) and reverse (PTR) records for a host only if the
forward (A) record exists.
- 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 (napalm_helpers.convert(napalm_helpers.mac, rci) !=
napalm_helpers.convert(napalm_helpers.mac, chassis)):
continue
rows.append({