Showing 9,400 of 17,590 total issues
Avoid deeply nested control flow statements. Open
Open
if "{0}".format(vmconfig['current'][prop]) == "{0}".format(vmconfig['state'][prop]):
continue
# add property to changeset
vmconfig['changed'][prop] = vmconfig['state'][prop]
Avoid deeply nested control flow statements. Open
Open
if 'remove_{0}'.format(collection) not in vmconfig['changed']:
vmconfig['changed']['remove_{0}'.format(collection)] = []
# remove property
vmconfig['changed']['remove_{0}'.format(collection)].append(prop)
Avoid deeply nested control flow statements. Open
Open
if vmconfig['state']['hostname'] in __salt__['vmadm.list'](order='hostname', search='state=running'):
__salt__['vmadm.reboot'](vm=vmconfig['state']['hostname'], key='hostname')
if kvm_needs_start:
Avoid deeply nested control flow statements. Open
Open
if not revs_match \
and not update_head \
and formatted_actions:
ret['comment'] = formatted_actions
return ret
Avoid deeply nested control flow statements. Open
Open
if exc.errno != errno.ENOENT:
removal_errors[target_path] = exc
if removal_errors:
Avoid deeply nested control flow statements. Open
Open
for current_cfg in vmconfig['current'][instance]:
if vmconfig_type['instance'][instance] not in state_cfg:
continue
if state_cfg[vmconfig_type['instance'][instance]] == current_cfg[vmconfig_type['instance'][instance]]:
Avoid deeply nested control flow statements. Open
Open
if comments:
msg += _format_comments(comments)
return _neutral_test(ret, msg)
Avoid deeply nested control flow statements. Open
Open
if disk['image_uuid'] not in res:
ret['result'] = False
ret['comment'] = 'failed to import image {0}'.format(disk['image_uuid'])
else:
Avoid deeply nested control flow statements. Open
Open
if remote in remotes:
try:
# Do a rev-parse on <remote>/<rev> to get
# the local SHA1 for it, so we can compare
# it to the remote_rev SHA1.
Avoid deeply nested control flow statements. Open
Open
if key not in safe_keys and key in optional_keys:
if dic[key] == optional_keys[key]:
del dic[key]
# removes add on arguments from triggers
Avoid deeply nested control flow statements. Open
Open
if not msg:
msg = 'There was an error setting syslog config \'{0}\'. ' \
'Please check debug logs.'.format(key)
ret['comment'] = msg
Avoid deeply nested control flow statements. Open
Open
if exc.errno != errno.ENOENT:
removal_errors[target_path] = exc
if removal_errors:
Avoid deeply nested control flow statements. Open
Open
if git_ver >= _LooseVersion('1.8.0'):
upstream_action = 'Tracking branch was unset'
branch_opts = ['--unset-upstream']
else:
branch_opts = None
Avoid deeply nested control flow statements. Open
Open
if __opts__['test']:
changes['result'] = True
changes['comment'] = "Row will be update in " + table
else:
Avoid deeply nested control flow statements. Open
Open
if add_instance:
# create add_ array
if 'add_{0}'.format(instance) not in vmconfig['changed']:
vmconfig['changed']['add_{0}'.format(instance)] = []
Avoid deeply nested control flow statements. Open
Open
if kvm_needs_start:
__salt__['vmadm.start'](vm=vmconfig['state']['hostname'], key='hostname')
else:
Avoid deeply nested control flow statements. Open
Open
if __salt__['git.symbolic_ref'](
target,
'HEAD',
opts=['--quiet'],
user=user,
Function table_absent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def table_absent(name, db):
'''
Make sure the specified table does not exist
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 'error' in deletedmed:
error.append(deletedmed['error'])
Avoid deeply nested control flow statements. Open
Open
if prop in vmconfig['current'][collection] and \
vmconfig['current'][collection][prop] == vmconfig['state'][collection][prop]:
continue
# skip update if not enforcing