Showing 9,400 of 17,590 total issues
Avoid deeply nested control flow statements. Open
if not _ret:
_ret = __salt__['boto_ec2.release_eip_address'](public_ip=None,
allocation_id=eip_alloc['allocation_id'],
region=region,
key=key,
Avoid deeply nested control flow statements. Open
if not __salt__['boto_ec2.delete_tags'](resource_ids=instance_id, tags=remove,
region=region, key=key, keyid=keyid,
profile=profile):
msg = "Error while deleting tags on instance {0}".format(instance_name if
instance_name else name)
Avoid deeply nested control flow statements. Open
if __opts__.get('test'):
ret['result'] = None
ret['comment'] = 'User roles "{0}" will been updated'.format(name)
return ret
addargs = dict({'user': name, 'role': role,
Avoid deeply nested control flow statements. Open
if local_dst_addrs[idx].lower() != remote_dst_addrs[idx].lower():
ret['changes']['destination_address_prefixes'] = {
'old': rule.get('destination_address_prefixes'),
'new': destination_address_prefixes
}
Function configmap_present
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def configmap_present(
name,
namespace='default',
data=None,
source=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 local_src_addrs[idx].lower() != remote_src_addrs[idx].lower():
ret['changes']['source_address_prefixes'] = {
'old': rule.get('source_address_prefixes'),
'new': source_address_prefixes
}
Avoid deeply nested control flow statements. Open
if 'roles' in ret['changes']:
ret['changes']['roles'].append(oldrole)
else:
ret['changes']['roles'] = [oldrole]
else:
Avoid deeply nested control flow statements. Open
for cid in disconnected_containers:
try:
cinfo = __salt__['docker.inspect_container'](cid)
netinfo = cinfo['NetworkSettings']['Networks'][name]
# Links and Aliases will be None if not
Avoid deeply nested control flow statements. Open
if attr not in entry_status['mentioned_attributes']:
to_delete.add(attr)
for attr in to_delete:
Avoid deeply nested control flow statements. Open
if existing_vals:
entry[attr] = existing_vals
elif directive == 'replace':
Avoid deeply nested control flow statements. Open
if 'ipv4addr' in addr:
obj_addrs.append(addr['ipv4addr'])
if 'ipv6addrs' in obj:
Avoid deeply nested control flow statements. Open
if n:
op = 'modify'
assert o != n
__salt__['ldap3.change'](l, dn, o, n)
else:
Avoid deeply nested control flow statements. Open
if key_name.endswith('Address'):
connect_kwargs[arg_name] = \
connect_kwargs[arg_name].rsplit('/', 1)[0]
try:
Avoid deeply nested control flow statements. Open
if 'ipv6addr' in addr:
obj_addrs.append(addr['ipv6addr'])
# replace func:nextavailableip: if an ip address is already found in that range.
if 'ipv4addrs' in data:
Function dashboard_absent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def dashboard_absent(
name,
hosts=None,
profile='grafana'):
'''
- 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 'ipv4addr' in addr:
addrobj = addr['ipv4addr']
if addrobj.startswith('func:nextavailableip:'):
found_matches = 0
for ip in obj_addrs:
Avoid deeply nested control flow statements. Open
if item_id_value in [value]:
item_create_required = False
# constraints match on '(id:<id>)'
elif item in ['constraint']:
Avoid deeply nested control flow statements. Open
if line_key == test_key:
keys_match = True
# if the key was found in the line and separation was successful
if keys_match:
Function _check_touch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _check_touch(name, atime, mtime):
'''
Check to see if a file needs to be updated or created
'''
ret = {
- 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 exc.strerror.startswith('Path not found'):
errors.append(exc.strerror)