Showing 9,400 of 17,590 total issues
Avoid deeply nested control flow statements. Open
for p_name in current_policy[policy_data['output_section']]:
if policy_name.lower() == p_name.lower():
currently_set = True
pol_id = p_name
break
Avoid deeply nested control flow statements. Open
if not r:
ret['comment'] = 'No EC2 instance with tag {} == {} found'.format(tag_name,
tag_value)
log.error(ret['comment'])
ret['result'] = False
Function _inherited_row
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _inherited_row(row, base_rows_from_pillar, ret):
'''Return a row with properties from parents.'''
base_rows = []
for base_row_from_pillar in base_rows_from_pillar:
base_row = __salt__['pillar.get'](base_row_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
if disconnected:
# We succeeded in disconnecting but failed
# to reconnect. This can happen if the
# network's subnet has changed and we try
# to reconnect with the same IP address
Avoid deeply nested control flow statements. Open
if not policies_are_equal:
additional_policy_comments = []
if policy_data['policy_lookup'][policy_name]['rights_assignment'] and cumulative_rights_assignments:
for user in policy_data['requested_policy'][policy_name]:
if user not in current_policy[policy_data['output_section']][pol_id]:
Avoid deeply nested control flow statements. Open
if res:
log.debug('Found %s %s for instance %s', instance_attr, res, instance.id)
fixed_rrs += [__salt__['boto3_route53.aws_encode'](res)]
else:
ret['comment'] = 'Attribute {} not found on instance {}'.format(instance_attr,
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'
)
Function _inherited_panel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _inherited_panel(panel, base_panels_from_pillar, ret):
'''Return a panel with properties from parents.'''
base_panels = []
for base_panel_from_pillar in base_panels_from_pillar:
base_panel = __salt__['pillar.get'](base_panel_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
if tid is not None and tid in removes:
ix = removes.index(tid)
removes.pop(ix)
r = __salt__['boto_cloudwatch_event.put_targets'](Rule=Name,
Function absent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def absent(name, **client_args):
'''
Ensure that given user is absent.
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"
Further reading
Function send_msg
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def send_msg(name,
recipient,
subject,
sender=None,
profile=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 trim_output:
files = files[:trim_output]
except tarfile.ReadError:
Avoid deeply nested control flow statements. Open
if internal and (current_type != ['internal']):
ret['comment'] = comments['comment_port_internal']
else:
ret['comment'] = comments['comment_port_exists']
else:
Avoid deeply nested control flow statements. Open
if port_add:
ret['result'] = True
ret['comment'] = comments['comment_port_internal']
ret['changes'] = comments['changes_port_internal']
else:
Avoid deeply nested control flow statements. Open
if created_destdir:
_cleanup_destdir(name)
ret['result'] = False
Function monitor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def monitor(name):
'''
Get the summary from module monit and try to see if service is
being monitored. If not then monitor the service.
'''
- 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 mode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def mode(name):
'''
Verifies the mode SELinux is running in, can be set to enforcing,
permissive, or disabled
- 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 six.text_type(original_top_level_opts[option]) == six.text_type(options[option]):
ret['comment'] += 'Unchanged key {0}.\n'.format(option)
else:
ret['comment'] += 'Changed key {0}.\n'.format(option)
ret['result'] = None
Avoid deeply nested control flow statements. Open
if to_append:
msg += ' append "{0}"'.format(list(to_append))
if to_trim:
Avoid deeply nested control flow statements. Open
if 'service.force_reload' in __salt__ and force:
func = __salt__['service.force_reload']
verb = 'forcefully reload'
else:
func = __salt__['service.reload']