Showing 9,400 of 17,590 total issues
Function present
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def present(name, auth=None, **kwargs):
'''
Ensure a security group exists.
You can supply either project_name or project_id.
- 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 _search_name in user_acl and user_acl[_search_name]['octal'] == octal_sum:
acl_found = True
break
if not acl_found:
Avoid deeply nested control flow statements. Open
if key == 'machine' and new == '':
continue # we don't know the default machine name
ret['changes'][key] = {'old': value, 'new': new}
Avoid deeply nested control flow statements. Open
if pvs[realdev]['Volume Group Name'] == name:
ret['changes'].update(
{device: 'added to {0}'.format(name)})
else:
ret['comment'] = '{0}\n{1}'.format(
Avoid deeply nested control flow statements. Open
if os.stat(full_path)[stat.ST_MTIME] > winrepo_cachefile_mtime:
ret['comment'] = 'mtime({0}) < mtime({1})'.format(winrepo_cachefile, full_path)
execute = True
break
Avoid deeply nested control flow statements. Open
if __opts__['test']:
ret.update({'comment': 'New permissions will be applied for '
'{0}: {1}'.format(acl_names, perms),
'result': None, 'changes': changes})
ret['result'] = None
Avoid deeply nested control flow statements. Open
if users[search_name]['octal'] == sum([_octal.get(i, i) for i in perms]):
ret['comment'] = 'Permissions are in the desired state'
else:
changes.update({'new': {'acl_name': ', '.join(acl_names),
'acl_type': acl_type,
Avoid deeply nested control flow statements. Open
if isinstance(val, datetime.datetime):
val = val.strftime('%Y-%m-%d %H:%M:%S')
dict_[propname] = val
Avoid deeply nested control flow statements. Open
if force:
__salt__['acl.wipefacls'](name, recursive=recurse, raise_err=True)
Function _validate_swagger_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _validate_swagger_file(self):
'''
High level check/validation of the input swagger file based on
https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md
- 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 result.get('stderr'):
comments.append(result['stderr'])
ret['comment'] = '\n'.join(comments)
Function publish_api
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def publish_api(self, ret, stage_variables):
'''
this method tie the given stage_name to a deployment matching the given swagger_file
'''
stage_desc = dict()
- 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 second.get('label', '') == name:
interface_status = True
if enabled:
Function _get_model_without_dependencies
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_model_without_dependencies(self, models_dict):
'''
Helper function to find the next model that should be created
'''
next_model = 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
if changes['gateway'] is None:
comments.append('Default gateway will be removed')
else:
comments.append(
'Default gateway will be set to {0}'
Avoid deeply nested control flow statements. Open
if len(r) > 1:
ret['comment'] = 'Multiple EC2 instances with tag {} == {} found'.format(
tag_name, tag_value)
log.error(ret['comment'])
ret['result'] = False
Function _expand_probes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _expand_probes(probes, defaults):
'''
Updates the probes dictionary with different levels of default values.
'''
- 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 user1['member_order'] == user2['member_order'] - 1:
found = True
break
if not found:
Avoid deeply nested control flow statements. Open
if len(fields) != 5:
log.warning("Invalid magic RR value seen: '%s'. Passing as-is.", rr)
fixed_rrs += [rr]
continue
tag_name = fields[2]
Avoid deeply nested control flow statements. Open
for alias in policy_data['policy_lookup'][policy_name]['policy_aliases']:
log.debug('checking alias %s', alias)
if alias in current_policy[policy_data['output_section']]:
currently_set = True
pol_id = alias