Showing 9,400 of 17,590 total issues
Avoid deeply nested control flow statements. Open
if not isinstance(val, list):
temp = [val]
val = temp
val.append(xml_to_dict(n))
Function image_list
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def image_list(self, name=None):
'''
List server images
'''
nt_ks = self.compute_conn
- 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 results[-1] == '(' and word in ('and', 'or'):
log.error('Invalid beginning operator after "(": %s', word)
return {'minions': [], 'missing': []}
if word == 'not':
Avoid deeply nested control flow statements. Open
if isinstance(fun_kwargs, dict) and '__kwarg__' in fun_kwargs:
fun_args = list(fun_args) # copy on modify
del fun_args[-1]
else:
fun_kwargs = None
Function _data2rec_group
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _data2rec_group(schema, recs_data, group_key):
if not isinstance(recs_data, (list, tuple)):
recs_data = [recs_data]
res = OrderedDict()
- 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 stripped.startswith(os.linesep):
stripped = stripped[len(os.linesep):]
if stripped:
Avoid deeply nested control flow statements. Open
for result in self._perform_actions(fullpath, fstat=fstat):
yield result
Function find_json
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_json(raw):
'''
Pass in a raw string and load the json when it starts. This allows for a
string to start with garbage and end with json but be cleanly loaded
'''
- 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 name.endswith(('.pyc', '.pyo')):
digest_collector.add(os.path.join(root, name))
arcname = os.path.join(site_pkg_dir, root, name)
if hasattr(tfp, 'getinfo'):
try:
Function _check_criteria
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _check_criteria(self, dirpath, name, fullpath, fstat=None):
match = True
for criterion in self.criteria:
if fstat is None and criterion.requires() & _REQUIRES_STAT:
try:
- 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 'part' not in ks_opts.keys():
ks_opts['part'] = []
ks_opts['part'].append(parse_partition(line))
Avoid deeply nested control flow statements. Open
if 'no' in interface['onboot']:
sls[device]['enabled'] = False
else:
sls[device]['enabled'] = True
del interface['onboot']
Avoid deeply nested control flow statements. Open
if 'network' not in ks_opts.keys():
ks_opts['network'] = []
ks_opts['network'].append(parse_network(line))
Avoid deeply nested control flow statements. Open
with salt.utils.files.fopen(pyminver) as fh_:
overwrite = fh_.read() != str(sys.version_info[0]) # future lint: disable=blacklisted-function
else:
Avoid deeply nested control flow statements. Open
if not name.endswith(('.pyc', '.pyo')):
digest_collector.add(os.path.join(root, name))
arcname = os.path.join(ns, site_pkg_dir, root, name)
if hasattr(tfp, 'getinfo'):
try:
Avoid deeply nested control flow statements. Open
if type(interface[option]) is bool:
sls[device][option] = {'enabled': [interface[option]]}
else:
sls[device][option] = interface[option]
if 'hostname' in interface:
Avoid deeply nested control flow statements. Open
with salt.utils.files.fopen(pythinver) as fh_:
overwrite = fh_.read() != str(sys.version_info[0]) # future lint: disable=blacklisted-function
else:
Function rename
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def rename(src, dst):
'''
On Windows, os.rename() will fail with a WindowsError exception if a file
exists at the destination path. This function checks for this error and if
found, it deletes the destination path first.
- 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 root.startswith('salt') and os.path.join(root, name) not in min_files:
continue
tfp.add(os.path.join(root, name),
Avoid deeply nested control flow statements. Open
if stripped:
self.stderr_logger.log(self.stderr_logger_level, stripped)
except OSError: