Showing 9,400 of 17,590 total issues
Avoid deeply nested control flow statements. Open
Open
if not _write_secedit_data(_secedits):
msg = ('Error while attempting to set policies via '
'secedit. Some changes may not be applied as '
'expected')
raise CommandExecutionError(msg)
Avoid deeply nested control flow statements. Open
Open
if k == 0:
do_test = False
if do_test and isinstance(k, int) and item & k == k:
Avoid deeply nested control flow statements. Open
Open
if not value == 'None':
# The value is not None, make the change
row['Inclusion Setting'] = auditpol_values[value]
row['Setting Value'] = value
log.debug('LGPO: Setting {0} to {1}'
Avoid deeply nested control flow statements. Open
Open
for p_item in presentation_element.getchildren():
if p_item == result:
break
else:
if etree.QName(p_item.tag).localname == 'text':
Avoid deeply nested control flow statements. Open
Open
for setting in _netshs:
log.debug('Setting firewall policy: %s', setting)
log.debug(_netshs[setting])
_set_netsh_value(**_netshs[setting])
Avoid deeply nested control flow statements. Open
Open
for _modal_set in _modal_sets:
try:
_existingModalData = win32net.NetUserModalsGet(None, _modal_set)
_newModalSetData = dictupdate.update(_existingModalData, _modal_sets[_modal_set])
log.debug('NEW MODAL SET = %s', _newModalSetData)
Avoid deeply nested control flow statements. Open
Open
if 'key' in temp_pol.attrib:
temp_pol = _updatePolicyElements(temp_pol, temp_pol.attrib['key'])
policydefs_policies_xpath(t_policy_definitions)[0].append(temp_pol)
Avoid deeply nested control flow statements. Open
Open
for elements_item in ELEMENTS_XPATH(admx_policy):
for child_item in elements_item.getchildren():
this_element_name = _getFullPolicyName(
policy_item=child_item,
policy_name=child_item.attrib['id'],
Function mkconfig
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def mkconfig(config=None,
tmp=None,
id_=None,
approve_key=True,
pub_key=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 vtype == 'REG_DWORD' or vtype == 'REG_QWORD':
if value:
if vtype == 'REG_DWORD':
for v in struct.unpack(b'I', value):
value = v
Avoid deeply nested control flow statements. Open
Open
if this_policynamespace not in policy_vals:
policy_vals[this_policynamespace] = {}
policy_vals[this_policynamespace][this_policyname] = this_policy_setting
Function _dasd_conversion
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def _dasd_conversion(cls, val, **kwargs):
'''
converts 0/1/2 for dasd reg key
'''
if val is not 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 prepended_text.endswith('.'):
prepended_text = ''
if the_localname == 'textBox' \
Avoid deeply nested control flow statements. Open
Open
if installed == pkg_version:
ret[pkg] = ''
else:
ret[pkg] = pkg_version
except ValueError:
Avoid deeply nested control flow statements. Open
Open
if not _ret:
msg = ('Error while attempting to write Administrative Template Policy data.'
' Some changes may not be applied as expected')
raise CommandExecutionError(msg)
return True
Avoid deeply nested control flow statements. Open
Open
if this_element_value is not None:
element_valuenames = ['{0}{1}'.format(
element.attrib['valuePrefix'], k) for k in element_valuenames]
else:
Avoid deeply nested control flow statements. Open
Open
if etree.QName(admx_item).localname == 'policy':
if admx_item not in admx_policies:
admx_policies.append(admx_item)
else:
for policy_item in POLICY_ANCESTOR_XPATH(admx_item):
Avoid deeply nested control flow statements. Open
Open
if not getattr(adml_search_result, 'text', '').strip() == policy_name:
adml_to_remove.append(adml_search_result)
else:
if hierarchy:
log.debug('we have hierarchy of %s', hierarchy)
Avoid deeply nested control flow statements. Open
Open
if hierarchy_item in policy_vals[policy_namespace]:
tdict = {}
first_item = True
for item in hierarchy[policy_namespace][hierarchy_item]:
newdict = {}
Avoid deeply nested control flow statements. Open
Open
if 'class' in this_policy.attrib:
if this_policy.attrib['class'] == registry_class or this_policy.attrib['class'] == 'Both':
if 'key' in this_policy.attrib:
this_key = this_policy.attrib['key']
else: