Showing 9,400 of 17,590 total issues
Avoid deeply nested control flow statements. Open
if isinstance(crd[nk], list):
crd[nk].append(ret[i])
else:
crd[nk] = [crd[nk], ret[i]]
else:
Avoid deeply nested control flow statements. Open
if neighbor_ip and neighbor_ip != neighbor.get('remote_address'):
# requested filtering by neighbors IP addr
continue
if ipnet_obj and neighbor.get('remote_address'):
Avoid deeply nested control flow statements. Open
if matches is not None:
name = matches.group(1).strip()
alias = matches.group(2).strip()
Function _cleanup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _cleanup(obj):
if obj:
if isinstance(obj, dict):
obj.pop('__', None)
for k, v in six.iteritems(obj):
- 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 name not in state_globals:
raise ImportError(
'\'{0}\' was not found in \'{1}\''.format(
name,
import_file
Avoid deeply nested control flow statements. Open
for item in record.get(key):
ret[key] = item
if key in lists:
Avoid deeply nested control flow statements. Open
if not self.ignore_null or ret[i] is not None:
crd[nk] = ret[i]
# Get key list and work backwards. This is inner-out processing
ks = list(listify_dicts.keys())
Avoid deeply nested control flow statements. Open
for field in display_fields:
if field in neighbor:
row[field] = neighbor[field]
rows.append(row)
Avoid deeply nested control flow statements. Open
for key in salt.utils.args.split_input(search_target):
if fnmatch.fnmatch(target, key):
_match = True
Avoid deeply nested control flow statements. Open
if minion_id in match:
ngroup_dir = os.path.join(
nodegroups_dir, six.text_type(nodegroup))
ngroup_pillar = salt.utils.dictupdate.merge(ngroup_pillar,
_construct_pillar(ngroup_dir,
Avoid deeply nested control flow statements. Open
if len(skey) > 1 and key.rfind('()') > 0:
rkey = skey[0].rstrip(__opts__['pepa_delimiter'])
operator = skey[1]
Avoid deeply nested control flow statements. Open
for key, val in six.iteritems(arg):
if key == 'names':
for _name in val:
if _name not in names:
names.append(_name)
Avoid deeply nested control flow statements. Open
if isinstance(item, six.string_types) and item not in env_matches:
env_matches.append(item)
return matches
Function _run_check
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _run_check(self, low_data):
'''
Check that unless doesn't return 0, and that onlyif returns a 0.
'''
ret = {'result': False, '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 len(comps) >= 2:
# Merge the comps
comps[1] = '.'.join(comps[1:len(comps)])
high[name] = {
Function ext_pillar
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ext_pillar(minion_id, pillar, *args, **kwargs):
stack = {}
stack_config_files = list(args)
traverse = {
'pillar': functools.partial(salt.utils.data.traverse_dict_and_list, 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
if key in immutable:
log.warning('Key %s is immutable, changes are not allowed', key)
elif rkey in immutable:
log.warning("Key %s is immutable, changes are not allowed", rkey)
elif operator == 'merge()' or operator == 'imerge()':
Avoid deeply nested control flow statements. Open
if state == 'require' or state == 'watch':
continue
errors.append(('No function declared in state \'{0}\' in'
Avoid deeply nested control flow statements. Open
if hasattr(data, 'availableField'):
vmware_pillar[pillar_key]['annotations'] = {}
for availableField in data.availableField:
for customValue in data.customValue:
if availableField.key == customValue.key:
Avoid deeply nested control flow statements. Open
for comp in ctop[saltenv][tgt]:
if isinstance(comp, dict):
if 'match' in comp:
matches.append(comp)
if 'order' in comp: