Showing 9,400 of 17,590 total issues
Avoid deeply nested control flow statements. Open
if word == 'not':
if not results[-1] in ('&', '|', '('):
results.append('&')
results.append('(')
results.append(six.text_type(set(minions)))
Avoid deeply nested control flow statements. Open
if decomposed:
words = decomposed + words
continue
Avoid deeply nested control flow statements. Open
for field in hide_fields:
if item == field:
log_data[item] = 'XXXXXXXXXX'
log.trace('Request POST Data: %s', pprint.pformat(log_data))
Function string_to_value
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def string_to_value(value):
temp = value.lower()
result = None
if temp == "true":
result = True
- 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 not isinstance(value, novaclient.base.Manager):
continue
if value.__class__.__name__ == attr:
Function _fetch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _fetch(resources, name_or_id):
ret = []
for resource in resources:
if resource['id'] == name_or_id:
return resource
- 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 self.__fun_check(ind[valid], fun, fun_args, fun_kwargs):
return True
except TypeError:
Function send_signal_to_processes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def send_signal_to_processes(self, signal_):
if (salt.utils.platform.is_windows() and
signal_ in (signal.SIGTERM, signal.SIGINT)):
# On Windows, the subprocesses automatically have their signal
# handlers invoked. If you send one of these signals while the
- 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 value.__class__.__name__ == attr:
setattr(connection, key, extension.manager_class(connection))
Avoid deeply nested control flow statements. Open
if idx < len(config):
continue
_namespace = '[{0}]'.format(idx)
Function create_firewall_rule
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_firewall_rule(self, protocol, action, **kwargs):
'''
Create a new firlwall rule
'''
body = {'protocol': protocol, 'action': action}
- 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 show_ip:
minions.add((id_, ipv6))
else:
minions.add(id_)
break
Avoid deeply nested control flow statements. Open
if self.__fun_check(ind[valid], fun, args.get('arg'), args.get('kwarg')):
return True
return False
Avoid deeply nested control flow statements. Open
if isinstance(cert, six.string_types):
if os.path.exists(cert):
cert_chain = (cert)
elif isinstance(cert, list):
if os.path.exists(cert[0]) and os.path.exists(cert[1]):
Avoid deeply nested control flow statements. Open
if hasattr(ssl, 'SSLContext'):
# Python >= 2.7.9
context = ssl.SSLContext.load_cert_chain(*cert_chain)
handlers.append(urllib_request.HTTPSHandler(context=context)) # pylint: disable=E1123
else:
Avoid deeply nested control flow statements. Open
if word == 'not':
results.append('(')
results.append(six.text_type(set(minions)))
results.append('-')
unmatched.append('-')
Avoid deeply nested control flow statements. Open
if self.__fun_check(ind[valid], fun_name, args.get('arg'), args.get('kwarg')):
return True
if valid[1:] == form or valid == '@{0}s'.format(form):
Avoid deeply nested control flow statements. Open
if not isinstance(val, list):
temp = [val]
val = temp
val.append(n.data)
Avoid deeply nested control flow statements. Open
if namespace:
_namespace = '{0}{1}'.format(namespace, _namespace)
changes[_namespace] = {
Avoid deeply nested control flow statements. Open
if show_ip:
minions.add((id_, ipv4))
else:
minions.add(id_)
break