Showing 9,400 of 17,590 total issues
Avoid deeply nested control flow statements. Open
Open
if mount:
comment = ('{0} is mounted, but its fstab entry '
'must be updated.').format(name)
else:
comment = ('The {0} fstab entry '
Avoid deeply nested control flow statements. Open
Open
if current_member['name'] == member['name']:
added_member = current_member
break
Avoid deeply nested control flow statements. Open
Open
if 'result' in result and not result['result']:
ret['result'] = result['result']
ret['comment'].append(result['comment'])
else:
ret['comment'].append('Set trust level for {0} to {1}'.format(key, trust))
Avoid deeply nested control flow statements. Open
Open
if keyval_option in mount_invisible_keys:
opt = keyval_option
Avoid deeply nested control flow statements. Open
Open
if size_match:
converted_size = _size_convert(size_match)
opt = "size={0}k".format(converted_size)
# make cifs option user synonym for option username which is reported by /proc/mounts
if fstype in ['cifs'] and opt.split('=')[0] == 'user':
Avoid deeply nested control flow statements. Open
Open
if opt.split('=')[0] in name_id_opts and len(opt.split('=')) > 1:
_givenid = opt.split('=')[1]
_param = opt.split('=')[0]
_id = _givenid
if not re.match('[0-9]+$', _givenid):
Avoid deeply nested control flow statements. Open
Open
if args['type'] == 'password':
ret['changes'][key] = '(password hidden)'
else:
ret['changes'][key] = ('{0}').format(args['value'])
else:
Avoid deeply nested control flow statements. Open
Open
if current_keys[key]['trust'] != TRUST_MAP[trust]:
# update trust level
result = __salt__['gpg.trust_key'](keyid=key,
trust_level=trust,
user=user,
Avoid deeply nested control flow statements. Open
Open
if _missing:
if __opts__['test']:
ret['result'] = None
ret['comment'] = ('Remount would be forced because'
' options ({0})'
Avoid deeply nested control flow statements. Open
Open
if opt in mount_translate_options:
opt = mount_translate_options[opt]
Avoid deeply nested control flow statements. Open
Open
if mount:
comment = ('{0} is mounted, but needs to be '
'written to the fstab in order to be '
'made persistent.').format(name)
else:
Avoid deeply nested control flow statements. Open
Open
if fstype in ['cifs'] and opt.split('=')[0] == 'user':
opt = "username={0}".format(opt.split('=')[1])
Avoid deeply nested control flow statements. Open
Open
if opt.split('=')[0] in mount_ignore_fs_keys.get(fstype, []):
opt = opt.split('=')[0]
# convert uid/gid to numeric value from user/group name
name_id_opts = {'uid': 'user.info',
Avoid deeply nested control flow statements. Open
Open
for _active_opt in _active_superopts:
size_match = re.match(r'size=(?P<size_value>[0-9]+)(?P<size_unit>k|m|g)', _active_opt)
if size_match:
converted_size = _size_convert(size_match)
opt = "size={0}k".format(converted_size)
Avoid deeply nested control flow statements. Open
Open
if real_name in active:
ret['comment'] = "Unable to unmount"
ret['result'] = None
return ret
update_mount_cache = True
Avoid deeply nested control flow statements. Open
Open
if real_device != device:
ret['changes']['umount'] += " (" + real_device + ")"
ret['changes']['umount'] += ", current: " + ', '.join(device_list)
Function present
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def present(name,
passwd,
database=None,
user=None,
password=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
Avoid deeply nested control flow statements. Open
Open
if opt not in active[real_name]['opts'] \
and opt not in _active_superopts \
and opt not in mount_invisible_options \
and opt not in mount_ignore_fs_keys.get(fstype, []) \
and opt not in mount_invisible_keys:
Avoid deeply nested control flow statements. Open
Open
if output:
ret['comment'] = 'Successfully updated index template {0}'.format(name)
ret['changes'] = diff
else:
ret['result'] = False
Avoid deeply nested control flow statements. Open
Open
for _device in device_list:
if re.match(regex, _device):
_device_mismatch_is_ignored = _device
break
if _device_mismatch_is_ignored: