Showing 9,400 of 17,590 total issues
Avoid deeply nested control flow statements. Open
Open
if len(_new) == 3 and len(_old) == 3:
log.debug('_new[0] == _old[0]: %s',
six.text_type(_new[0]) == six.text_type(_old[0]))
log.debug('_new[2] == _old[2]: %s',
six.text_type(_new[2]) == six.text_type(_old[2]))
Avoid deeply nested control flow statements. Open
Open
if not value:
res = property_absent(name, key)
elif value:
res = property_present(name, key, value)
if res:
Avoid deeply nested control flow statements. Open
Open
if res:
ret['result'] = ret['result'] if res['result'] else False
ret['comment'].append(res['comment'])
if res['changes']:
if 'property' not in ret['changes']:
Avoid deeply nested control flow statements. Open
Open
if 'message' in res_uninstall:
ret['comment'].append(res_uninstall['message'])
ret['comment'] = "\n".join(ret['comment'])
Avoid deeply nested control flow statements. Open
Open
if resource_selector_property:
ret['changes'][resource_type][resource_selector_value][key] = _parse_value(kwargs[key])
else:
ret['changes'][resource_type][key] = _parse_value(kwargs[key])
if ret['comment'] == '':
Avoid deeply nested control flow statements. Open
Open
if 'resource_selector_property' in resource_cfg:
resource_selector_property = resource_cfg['resource_selector_property']
del resource_cfg['resource_selector_property']
if not resource_selector_property and key in _zonecfg_resource_default_selectors:
Avoid deeply nested control flow statements. Open
Open
if proto_name in d_rule:
d_rule_components[proto_name] = d_rule[proto_name]
del d_rule[proto_name]
Avoid deeply nested control flow statements. Open
Open
if mode.lower() == 'install':
res_install = __salt__['zoneadm.install'](name, nodataset, brand_opts)
ret['result'] = res_install['status']
if res_install['status']:
ret['changes'][name] = 'installed'
Avoid deeply nested control flow statements. Open
Open
if isinstance(value, list):
for respv in value:
resource_cfg.update(dict(respv))
Avoid deeply nested control flow statements. Open
Open
if __salt__['file.file_exists'](cfg_tmp):
__salt__['file.remove'](cfg_tmp)
else:
Avoid deeply nested control flow statements. Open
Open
if 'message' in res_detach:
ret['comment'].append(res_detach['message'])
ret['comment'] = "\n".join(ret['comment'])
Avoid deeply nested control flow statements. Open
Open
if not r.get('deleted'):
ret['result'] = False
ret['comment'] = 'Failed to update bucket: {0}.'.format(r['error']['message'])
return ret
else:
Function create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def create(name,
endpoint='incidents',
api_url=None,
page_id=None,
api_key=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 uninstalled
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def uninstalled(name, version=None, uninstall_args=None, override_args=False):
'''
Uninstalls a package
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
Avoid deeply nested control flow statements. Open
Open
if not resource_selector_property and key in _zonecfg_resource_default_selectors:
resource_selector_property = _zonecfg_resource_default_selectors[key]
Avoid deeply nested control flow statements. Open
Open
if resource_prune:
res = resource_absent(
name,
resource_cfg['resource_type'],
resource_selector_property=resource_selector_property,
Avoid deeply nested control flow statements. Open
Open
if role not in tenant_roles:
if __opts__.get('test'):
ret['result'] = None
ret['comment'] = 'User roles "{0}" will been updated'.format(name)
return ret
Avoid deeply nested control flow statements. Open
Open
if not __salt__['boto_ec2.create_tags'](resource_ids=instance_id, tags=add,
region=region, key=key, keyid=keyid,
profile=profile):
msg = "Error while creating tags on instance {0}".format(instance_name if
instance_name else name)
Avoid deeply nested control flow statements. Open
Open
if not vals:
# clean out empty attribute lists
to_delete.add(attr)
for attr in to_delete:
Avoid deeply nested control flow statements. Open
Open
if 'error' in reshard_response:
ret['result'] = False
comments.append('Encountered error while resharding {0}: {1}'
.format(name, reshard_response['error']))
_add_changes(ret, changes_old, changes_new, comments)