Showing 9,400 of 17,590 total issues
Function _parse_os_release
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def _parse_os_release(*os_release_files):
'''
Parse os-release and return a parameter dictionary
See http://www.freedesktop.org/software/systemd/man/os-release.html
- 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 req_key == 'sls':
# Allow requisite tracking of entire sls files
if fnmatch.fnmatch(chunk['__sls__'], req_val):
found = True
reqs[r_state].append(chunk)
Avoid deeply nested control flow statements. Open
Open
if req_key == 'sls':
# Allow requisite tracking of entire sls files
if fnmatch.fnmatch(chunk['__sls__'], req_val):
if requisite == 'prereq':
chunk['__prereq__'] = True
Avoid deeply nested control flow statements. Open
Open
if saltenv != cenv:
continue
log.debug(
Avoid deeply nested control flow statements. Open
Open
for key, val in six.iteritems(arg):
if key == 'names':
for _name in val:
if _name not in names:
names.append(_name)
Avoid deeply nested control flow statements. Open
Open
if not found:
continue
for lkey, lval in six.iteritems(listen_to):
Function _virtual_hv
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def _virtual_hv(osdata):
'''
Returns detailed hypervisor information from sysfs
Currently this seems to be used only by Xen
'''
- 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
for tgt in targets:
top[saltenv][tgt] = ctop[saltenv][tgt]
break
Avoid deeply nested control flow statements. Open
Open
if tgt not in top[saltenv]:
top[saltenv][tgt] = ctop[saltenv][tgt]
continue
m_type1, m_states1 = _read_tgt(top[saltenv][tgt])
Avoid deeply nested control flow statements. Open
Open
if match_type is not None:
merged.append(match_type)
merged.extend(m_states1)
Avoid deeply nested control flow statements. Open
Open
if not slsmod:
errors.append(
'Environment {0} contains an empty sls '
'index'.format(saltenv)
)
Avoid deeply nested control flow statements. Open
Open
if isinstance(req_val, six.string_types):
if (fnmatch.fnmatch(chunk['name'], req_val) or
fnmatch.fnmatch(chunk['__id__'], req_val)):
if req_key == 'id' or chunk['state'] == req_key:
found = True
Avoid deeply nested control flow statements. Open
Open
if req_ret['result'] is False:
# use SLS.ID for the key-- so its easier to find
key = '{sls}.{_id}'.format(sls=req_low['__sls__'],
_id=req_low['__id__'])
failed_requisites.add(key)
Avoid deeply nested control flow statements. Open
Open
if state_data.get('source', '').endswith('/init.sls'):
p_comps.append('init')
if level_count > len(p_comps):
Avoid deeply nested control flow statements. Open
Open
if isinstance(arg, dict):
if arg:
if next(six.iterkeys(arg)) == 'order':
found = True
if not found:
Avoid deeply nested control flow statements. Open
Open
if req_ret is None:
continue
# If the result was False (not None) it was a failure
if req_ret['result'] is False:
Avoid deeply nested control flow statements. Open
Open
if level_count > len(p_comps):
msg = ('Attempted relative include of \'{0}\' '
'within SLS \'{1}:{2}\' '
'goes beyond top level package '
.format(inc_sls, saltenv, sls))
Avoid deeply nested control flow statements. Open
Open
for id in part:
if id in minion_tracker[queue]['minions']:
minion_tracker[queue]['minions'].remove(id)
else:
salt.utils.stringutils.print_cli('minion {0} was already deleted from tracker, probably a duplicate key'.format(id))
Avoid deeply nested control flow statements. Open
Open
if minion in active:
active.remove(minion)
if bwait:
wait.append(datetime.now() + timedelta(seconds=bwait))
Avoid deeply nested control flow statements. Open
Open
if low['retry']['splay'] != 0:
interval = interval + random.randint(0, low['retry']['splay'])
log.info(