Showing 9,400 of 17,590 total issues
Avoid deeply nested control flow statements. Open
Open
if 'kill' in pdat[key]:
return 'kill'
else:
Avoid deeply nested control flow statements. Open
Open
if (fnmatch.fnmatch(chunk['name'], req_val) or
fnmatch.fnmatch(chunk['__id__'], req_val)):
if req_key == 'id' or chunk['state'] == req_key:
if requisite == 'prereq':
chunk['__prereq__'] = True
Avoid deeply nested control flow statements. Open
Open
if saltenv == 'include':
continue
elif saltenv != cenv:
log.debug(
'Section for saltenv \'%s\' in the \'%s\' '
Avoid deeply nested control flow statements. Open
Open
if ncnt > 5:
break
continue
Avoid deeply nested control flow statements. Open
Open
if retries == 1:
ret['start_time'] = orig_ret['start_time']
else:
Function _check_existing_archive
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def _check_existing_archive(self):
'''
Check if archive exists or not. If exists and --force was not specified,
bail out. Otherwise remove it and move on.
- 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 conf.get('salt.int.intfunc'):
self.out.put('Collecting {}'.format(info.lower()), indent=2)
self.collector.write(info, self._local_call(conf), output=output)
else:
self.collector.discard_current()
Avoid deeply nested control flow statements. Open
Open
if isinstance(minion_id, dict):
next_.append(minion_id.keys()[0])
else:
next_.append(minion_id)
Avoid deeply nested control flow statements. Open
Open
if key in disabled_reqs:
log.warning('The %s requisite has been disabled, Ignoring.', key)
continue
rkey = key.split('_')[0]
Avoid deeply nested control flow statements. Open
Open
for chunk in chunks:
if chunk['__id__'] == listen_to or \
chunk['name'] == listen_to:
listen_to = {chunk['state']: chunk['__id__']}
found = True
Avoid deeply nested control flow statements. Open
Open
if 'subfilter' in item:
_tmpdata = item.pop('subfilter')
for match, data in six.iteritems(_tmpdata):
_filter_matches(match, data, _opts)
if isinstance(item, six.string_types):
Avoid deeply nested control flow statements. Open
Open
if not isinstance(state[name][s_dec], list):
# quite certainly a syntax error, managed elsewhere
continue
state[name][s_dec].append(
Avoid deeply nested control flow statements. Open
Open
if key not in req_in:
continue
if key in disabled_reqs:
Avoid deeply nested control flow statements. Open
Open
if isinstance(items, list):
# Formed as a list of requisite additions
hinges = []
for ind in items:
if not isinstance(ind, dict):
Avoid deeply nested control flow statements. Open
Open
if isinstance(listvalue, dict):
# Search dict values in list for __slot__:
for key, value in listvalue.items():
try:
if value.startswith(SLOT_TEXT):
Avoid deeply nested control flow statements. Open
Open
if isinstance(listvalue, six.text_type):
# Search strings in a list for __slot__:
if listvalue.startswith(SLOT_TEXT):
log.trace("Slot processsing nested string %s", listvalue)
cdata[atype][ind][idx] = self.__eval_slot(listvalue)
Avoid deeply nested control flow statements. Open
Open
if minion not in parts:
parts[minion] = {}
parts[minion]['ret'] = {}
Avoid deeply nested control flow statements. Open
Open
if value.startswith(SLOT_TEXT):
log.trace("Slot processsing dict value %s", value)
cdata[atype][ind][key] = self.__eval_slot(value)
except AttributeError:
Avoid deeply nested control flow statements. Open
Open
for sls_target in sls_targets:
r_env = resolved_envs[0] if len(resolved_envs) == 1 else saltenv
mod_tgt = '{0}:{1}'.format(r_env, sls_target)
if mod_tgt not in mods:
nstate, err = self.render_state(
Avoid deeply nested control flow statements. Open
Open
with salt.utils.files.fopen('/proc/xen/capabilities') as fhr:
if 'control_d' not in fhr.read():
# Tested on CentOS 5.5 / 2.6.18-194.3.1.el5xen
grains['virtual_subtype'] = 'Xen PV DomU'
else: