Showing 9,400 of 17,590 total issues
Function _check_pkgin
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _check_pkgin():
'''
Looks to see if pkgin is present on the system, return full path
'''
ppath = salt.utils.path.which('pkgin')
- 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
if 'enabled' in beacon_config_dict and not beacon_config_dict['enabled']:
ret['result'] = True
ret['comment'] = 'Disabled beacon {0} on minion.' \
''.format(name)
else:
Avoid deeply nested control flow statements. Open
if name in beacons and beacons[name] == beacon_data:
ret['result'] = True
ret['comment'] = 'Added beacon: {0}.'.format(name)
else:
Avoid deeply nested control flow statements. Open
if not os.path.isabs(req_file):
req_file = os.path.join(cwd, req_file)
Avoid deeply nested control flow statements. Open
if not line.startswith('#') and mod_name:
mods.add(mod_name)
except IOError:
Avoid deeply nested control flow statements. Open
if 'enabled' in beacon_config_dict and beacon_config_dict['enabled']:
ret['result'] = True
ret['comment'] = 'Enabled beacon {0} on minion.' \
''.format(name)
else:
Avoid deeply nested control flow statements. Open
if not s[0] in pkglist:
if len(p) > 1 and p[1] in ('<', '', '='):
pkglist[s[0]] = s[1]
else:
pkglist[s[0]] = ''
Avoid deeply nested control flow statements. Open
if _policydata.policies[p_class]['policies'][policy]['Policy'].upper() == policy_name.upper():
_pol = _policydata.policies[p_class]['policies'][policy]
policy_name = policy
if _pol:
Avoid deeply nested control flow statements. Open
if proc_exitstatus != 0:
raise SaltInvocationError(
'Reprepro includedsc for codename {0} and file {1} failed with proc.status {2}'.format(
codename,
abs_file,
Function list_targets
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def list_targets(Rule,
region=None, key=None, keyid=None, profile=None):
'''
Given a rule name list the targets of that rule.
- 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
if six.PY2:
addr = six.text_type(addr)
# Adding this, as ipaddress would complain about valid
# addresses not being valid. #pythonIsFun
ip_values.append(capirca.lib.policy.nacaddr.IP(addr))
Avoid deeply nested control flow statements. Open
if ((__grains__['os'] in ['Ubuntu'] and __grains__['osmajorrelease'] < 18)
or (__grains__['os'] in ['Debian'] and __grains__['osmajorrelease'] <= 8)):
cmd = 'debsign --re-sign -k {0} {1}'.format(keyid, abs_file)
try:
proc = salt.utils.vt.Terminal(
Avoid deeply nested control flow statements. Open
if f not in ['N', 'D', 'H', 'L', 'X']:
logmsg = 'pdbedit.modify - unknown {} flag for account_control, ignored'.format(f)
log.warning(logmsg)
else:
new.append(f)
Function lsmod
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def lsmod():
'''
Return a dict containing information about currently loaded modules
CLI Example:
- 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
if 'enabled' in beacons and not beacons['enabled']:
ret['result'] = True
ret['comment'] = 'Disabled beacons on minion.'
else:
ret['result'] = False
Avoid deeply nested control flow statements. Open
if not os.path.exists(target_path):
logger.debug(
'Copying %s to %s', req_file, target_path
)
__salt__['file.copy'](req_file, target_path)
Avoid deeply nested control flow statements. Open
while proc.has_unread_data:
stdout, _ = proc.recv()
if stdout and REPREPRO_SIGN_PROMPT_RE.search(stdout):
# have the prompt for inputting the passphrase
proc.sendline(phrase)
Avoid deeply nested control flow statements. Open
if name in beacons and beacons[name] == beacon_data:
ret['result'] = True
ret['comment'] = 'Modified beacon: {0}.'.format(name)
elif event_ret:
Function search
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def search(pkg_name, **kwargs):
'''
Searches for an exact match using pkgin ^package$
CLI Example:
- 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
if cwd and src.startswith(cwd):
arc_name = os.path.relpath(src, cwd)
else:
arc_name = os.path.relpath(src, rel_root)
archived_files.append(arc_name)