Showing 9,400 of 17,590 total issues
Function _byteify
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _byteify(thing):
# Note that we intentionally don't treat odicts here - they won't
# compare equal in many circumstances where AWS treats them the same...
if isinstance(thing, dict):
return dict([(_byteify(k), _byteify(v)) for k, v in six.iteritems(thing)])
- 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 migrated
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def migrated(name,
remote_addr,
cert,
key,
verify_cert,
- 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 spost['inact'] != inactdays:
ret['comment'] = 'User {0} created but failed to set' \
' inactive days to' \
' {1}'.format(name, inactdays)
ret['result'] = False
Avoid deeply nested control flow statements. Open
if salt.utils.dateutils.strftime(spost['expire']) != salt.utils.dateutils.strftime(expire):
ret['comment'] = 'User {0} created but failed to set' \
' expire days to' \
' {1}'.format(name, expire)
ret['result'] = False
Avoid deeply nested control flow statements. Open
if mfa_deactivated:
ret['comment'] = ' '.join([ret['comment'], 'IAM user {0} MFA device {1} is deactivated.'.format(name, serial)])
if __opts__['test']:
Function cmd
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cmd(self, fun, arg=None, pub_data=None, kwarg=None, print_event=True, full_return=False):
'''
Execute a function
.. code-block:: python
- 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 result:
ret['changes'][entry['alias']] = "Added"
ret['comment'] += "Alias {0} added.\n".format(entry['alias'])
Avoid deeply nested control flow statements. Open
if spost['max'] != maxdays:
ret['comment'] = 'User {0} created but failed to set' \
' maximum days to' \
' {1}'.format(name, maxdays)
ret['result'] = False
Avoid deeply nested control flow statements. Open
if _delete_key(ret, k['access_key_id'], name, region, key, keyid, profile):
ret['comment'] = ' '.join([ret['comment'], 'Key {0} has been deleted.'.format(k['access_key_id'])])
ret['changes'][k['access_key_id']] = 'deleted'
# delete the user's MFA tokens
if delete_mfa_devices:
Function saml_provider_present
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def saml_provider_present(name, saml_metadata_document, region=None, key=None, keyid=None, profile=None):
'''
.. versionadded:: 2016.11.0
Ensure the SAML provider with the specified name is present.
- 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 spost['warn'] != warndays:
ret['comment'] = 'User {0} created but failed to set' \
' warn days to' \
' {1}'.format(name, warndays)
ret['result'] = False
Avoid deeply nested control flow statements. Open
if result:
ret['changes'][entry['alias']] = "Updated"
ret['comment'] += "Alias {0} updated.\n".format(entry['alias'])
else:
Avoid deeply nested control flow statements. Open
if key == 'passwd':
ret['changes'][key] = 'XXX-REDACTED-XXX'
else:
ret['changes'][key] = spost[key]
if __grains__['kernel'] in ('OpenBSD', 'FreeBSD') and lcpost != lcpre:
Avoid deeply nested control flow statements. Open
if spost['min'] != mindays:
ret['comment'] = 'User {0} created but failed to set' \
' minimum days to' \
' {1}'.format(name, mindays)
ret['result'] = False
Avoid deeply nested control flow statements. Open
if mfa_deleted:
ret['comment'] = ' '.join([ret['comment'], 'Virtual MFA device {0} is deleted.'.format(serial)])
# delete the user's login profile
if delete_profile:
Avoid deeply nested control flow statements. Open
if p == 'infrastructure_traffic_resource_pools':
changes_string += \
'\tinfrastructure_traffic_resource_pools:\n'
for idx in range(len(props_to_updated_values[p])):
d = props_to_updated_values[p][idx]
Function categorize_shim_errors
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def categorize_shim_errors(self, stdout_bytes, stderr_bytes, retcode):
stdout = salt.utils.stringutils.to_unicode(stdout_bytes)
stderr = salt.utils.stringutils.to_unicode(stderr_bytes)
if re.search(RSTR_RE, stdout) and stdout != RSTR+'\n':
# RSTR was found in stdout which means that the shim
- 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 host not in returned:
error = ('Target \'{0}\' did not return any data, '
'probably due to an error.').format(host)
ret = {'id': host,
'ret': error}
Avoid deeply nested control flow statements. Open
if 'num_shares' not in dvs[infra_prop][idx] and \
current_dvs[infra_prop][idx]['share_level'] != \
'custom' and \
'num_shares' in current_dvs[infra_prop][idx]:
Avoid deeply nested control flow statements. Open
if _valid_str(_comm_name):
_community_tmp[_comm_name] = _clear_community_details(_comm_details)
elif _valid_dict(_community):