Showing 9,400 of 17,590 total issues
Avoid deeply nested control flow statements. Open
Open
if result:
ret['changes'][team_name] = team_change
else:
ret['result'] = False
ret['comment'] = ('Failed to remove repo {0} from team {1}.'
Avoid deeply nested control flow statements. Open
Open
if __opts__['test']:
ret['changes'][team_name] = team_change
ret['result'] = None
else:
result = __salt__['github.add_team_repo'](name, team_name,
Function _preflight_check
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def _preflight_check(desired, fromrepo, **kwargs):
'''
Perform platform-specific checks on desired packages
'''
if 'pkg.check_db' not in __salt__:
- 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 __opts__['test']:
ret['comment'] = 'Org {0} user {1} role will be ' \
'updated'.format(name, username)
return ret
__salt__['grafana4.update_org_user'](
Avoid deeply nested control flow statements. Open
Open
if result:
ret['changes'][repo_name] = {
'old': 'Repo {0} is in team {1}'.format(repo_name, name),
'new': 'Repo {0} is not in team {1}'.format(repo_name, name)
}
Avoid deeply nested control flow statements. Open
Open
if verify_result:
to_reinstall[package_name] = version_string
altered_files[package_name] = verify_result
else:
Avoid deeply nested control flow statements. Open
Open
if 'heat_template_version' in template_parse:
template_new = salt.utils.yaml.safe_dump(template_parse)
else:
template_new = jsonutils.dumps(template_parse, indent=2, ensure_ascii=False)
salt.utils.files.safe_rm(template_tmp_file)
Avoid deeply nested control flow statements. Open
Open
if state:
changes = True
ret['result'] = True
else:
ret['comment'] = 'Target Group {0} failed to remove targets'.format(name)
Function running
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def running(name, restart=False, force=True):
'''
Ensure that the marathon app with the given id is present and restart if set.
:param name: The app name/id
- 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 sources:
reinstall_targets.append(reinstall_pkg)
else:
reinstall_targets.append(
_get_desired_pkg(reinstall_pkg, to_reinstall)
Avoid deeply nested control flow statements. Open
Open
if mode.lower() == 'attach':
res_attach = __salt__['zoneadm.attach'](name, False, brand_opts)
ret['result'] = res_attach['status']
if res_attach['status']:
ret['changes'][name] = 'attached'
Avoid deeply nested control flow statements. Open
Open
if zonecfg_res['status']:
ret['changes'][resource_type] = 'removed'
if ret['comment'] == '':
ret['comment'] = 'The {0} resource was removed.'.format(
resource_type,
Avoid deeply nested control flow statements. Open
Open
if zonecfg_res['status']:
ret['changes'][resource_type] = {}
ret['changes'][resource_type][resource_selector_value] = 'removed'
if ret['comment'] == '':
ret['comment'] = 'The {0} resource {1} was removed.'.format(
Avoid deeply nested control flow statements. Open
Open
if replace:
try:
__salt__['file.move'](cfg_tmp, path)
except CommandExecutionError:
if __salt__['file.file_exists'](cfg_tmp):
Avoid deeply nested control flow statements. Open
Open
if __opts__['test']:
ret['result'] = None
return ret
Avoid deeply nested control flow statements. Open
Open
for key in kwargs:
log.debug('zone.resource_preent - key=%s value=%s current_value=%s',
key,
resource[key] if key in resource else None,
_parse_value(kwargs[key]),
Avoid deeply nested control flow statements. Open
Open
if ret['result'] is None:
if __opts__['test']:
ret['result'] = True
else:
## update resource
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 'resource' not in ret['changes']:
Avoid deeply nested control flow statements. Open
Open
if 'message' in res_delete:
ret['comment'].append(res_delete['message'])
ret['comment'] = "\n".join(ret['comment'])
Avoid deeply nested control flow statements. Open
Open
if not r.get('updated'):
ret['result'] = False
ret['comment'] = 'Failed to update bucket: {0}.'.format(r['error']['message'])
return ret
if update and __opts__['test']: