Showing 9,400 of 17,590 total issues
Avoid deeply nested control flow statements. Open
if isinstance(requested_policy_check, six.string_types):
policies_are_equal = requested_policy_check == current_policy_check
elif isinstance(requested_policy_check, list):
policies_are_equal = salt.utils.data.compare_lists(
requested_policy_check,
Avoid deeply nested control flow statements. Open
if reduced or _name_matches(k, names):
newlist.append(reduced)
if newlist:
Avoid deeply nested control flow statements. Open
if current[m] != desired[m]:
need_update[m] = desired[m]
return need_update
Avoid deeply nested control flow statements. Open
if current[m] != desired[m]:
need_update[m] = desired[m]
return need_update
Avoid deeply nested control flow statements. Open
if all(x == '' for x in old):
return True
except TypeError:
Function import_cert
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def import_cert(name, cert_format=_DEFAULT_FORMAT, context=_DEFAULT_CONTEXT, store=_DEFAULT_STORE,
exportable=True, password='', saltenv='base'):
'''
Import the certificate file into the given certificate store.
- 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
Function _run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _run(name, mod, kwargs):
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
- 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 val is None:
errors.append(
'Config option \'{0}\' for network \'{1}\' is '
'missing a value'.format(key, net_name)
)
Avoid deeply nested control flow statements. Open
if val:
net_changes[key] = {'old': None, 'new': val}
try:
net_changes.pop('IPConfiguration')
except KeyError:
Avoid deeply nested control flow statements. Open
if 'error' in updatedint:
error.append(updatedint['error'])
Avoid deeply nested control flow statements. Open
for col, val in six.iteritems(res):
output_file.write(
salt.utils.stringutils.to_str(
col + ':' + val + '\n'
)
Avoid deeply nested control flow statements. Open
if key in interface_attrs:
interfaces_dict[intf_name][key] = value
Avoid deeply nested control flow statements. Open
for interface in hostinterfaces:
__salt__['zabbix.hostinterface_delete'](interfaceids=interface['interfaceid'],
**connection_args)
Function _find_image
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _find_image(name):
'''
Tries to find image with given name, returns
- image, 'Found image <name>'
- None, 'No such image found'
- 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 module != mod:
loaded_by_dependency.append(module)
loaded['yes'].append(mod)
Avoid deeply nested control flow statements. Open
for module in unload_result:
ret['changes'][module] = 'removed'
unloaded['yes'].append(mod)
Function _inherited_dashboard
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _inherited_dashboard(dashboard, base_dashboards_from_pillar, ret):
'''Return a dashboard with properties from parents.'''
base_dashboards = []
for base_dashboard_from_pillar in base_dashboards_from_pillar:
base_dashboard = __salt__['pillar.get'](base_dashboard_from_pillar)
- 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
for col, val in six.iteritems(query_result):
output_file.write(
salt.utils.stringutils.to_str(
'{0}:{1}\n'.format(col, val)
)
Avoid deeply nested control flow statements. Open
if current[m] != desired[m]:
need_update[m] = desired[m]
return need_update
Function absent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def absent(name, user=None, signal=None):
'''
Ensures that the named command is not running.
name
- 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"