Showing 9,400 of 17,590 total issues
Function _parse_selections
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _parse_selections(dpkgselection):
'''
Parses the format from ``dpkg --get-selections`` and return a format that
pkg.get_selections and pkg.set_selections work with.
'''
- 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 comp or (not comp and isinstance(comp, list)):
diffdict['new'].update({i: defined[i]})
diffdict['old'].update({i: existing[i]})
else:
Function upgrade
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def upgrade(refresh=True, dist_upgrade=False, **kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
- 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 source.comps:
try:
sources.remove(source)
except ValueError:
pass
Avoid deeply nested control flow statements. Open
if not launchpad_ppa_info['private']:
raise CommandExecutionError(
'PPA is not private but auth credentials '
'passed: {0}'.format(repo)
)
Avoid deeply nested control flow statements. Open
if ret['retcode'] != 0:
raise CommandExecutionError(
'Error: key retrieval failed: {0}'.format(ret['stdout'])
)
Function create_replication_group
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_replication_group(name, primary_cluster_id, replication_group_description,
wait=None, region=None, key=None,
keyid=None, profile=None):
'''
Create replication group.
- 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 http_proxy_url:
env = {'http_proxy': http_proxy_url,
'https_proxy': http_proxy_url}
if float(__grains__['osrelease']) < 12.04:
Avoid deeply nested control flow statements. Open
if float(__grains__['osrelease']) < 12.04:
cmd = ['apt-add-repository', repo]
else:
cmd = ['apt-add-repository', '-y', repo]
out = _call_apt(cmd, env=env, scope=False, **kwargs)
Avoid deeply nested control flow statements. Open
if 'keyid' not in kwargs:
error_str = 'Private PPAs require a ' \
'keyid to be specified: {0}/{1}'
raise CommandExecutionError(
error_str.format(owner_name, ppa_name)
Avoid deeply nested control flow statements. Open
if 'name' in kv and 'value' in kv:
resdata[key][kv['name']] = kv['value']
else:
log.warning('zonecfg.info - not sure how to deal with: %s', kv)
else:
Avoid deeply nested control flow statements. Open
if 'property' not in ret:
ret[key] = {}
kv = _parse_value(line.strip()[line.strip().index(':')+1:])
Avoid deeply nested control flow statements. Open
if bond['arp_ip_target']:
bond['arp_ip_target'] = bond['arp_ip_target'] + ',' + ip
else:
bond['arp_ip_target'] = ip
else:
Function ec2_credentials_get
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ec2_credentials_get(user_id=None, name=None, access=None,
profile=None, **connection_args):
'''
Return ec2_credentials for a user (keystone ec2-credentials-get)
- 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 show_all:
continue
line = line.strip()[1:-1]
Function ec2_credentials_list
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ec2_credentials_list(user_id=None, name=None, profile=None,
**connection_args):
'''
Return a list of ec2_credentials for a specific user (keystone ec2-credentials-list)
- 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 isinstance(ipconfig.get('load_balancer_backend_address_pools'), list):
# TODO: Add ID lookup for referenced object names
pass
if isinstance(ipconfig.get('load_balancer_inbound_nat_rules'), list):
Avoid deeply nested control flow statements. Open
if (tAce[0][1] & win32security.INHERITED_ACE) == win32security.INHERITED_ACE:
tdacl.DeleteAce(counter)
inheritedAcesRemoved.append(_ace_to_text(tAce, objectType))
else:
counter = counter + 1
Function user_delete
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def user_delete(user_id=None, name=None, profile=None, **connection_args):
'''
Delete a user (keystone user-delete)
CLI Examples:
- 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 isinstance(ipconfig.get('load_balancer_inbound_nat_rules'), list):
# TODO: Add ID lookup for referenced object names
pass
if ipconfig.get('public_ip_address'):