Showing 9,400 of 17,590 total issues
Function get_jids
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_jids():
'''
Return a list of all job ids
'''
query = '''SELECT jid, load FROM {keyspace}.jids;'''.format(keyspace=_get_keyspace())
- 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 _get_conn
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_conn(ret):
'''
Return a mongodb connection object
'''
_options = _get_options(ret)
- 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 get_minions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_minions():
'''
Return a list of minions
'''
query = '''SELECT DISTINCT minion_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 hours_difference > __opts__['keep_jobs'] and os.path.exists(t_path):
# Remove the entire f_path from the original JID dir
try:
shutil.rmtree(f_path)
except OSError as err:
Avoid deeply nested control flow statements. Open
with salt.utils.files.fopen(outp, 'rb') as rfh:
ret[fn_]['out'] = serial.load(rfh)
except Exception as exc:
Avoid deeply nested control flow statements. Open
if not results[-1] in ('and', 'or', '('):
results.append('and')
results.append(word)
Avoid deeply nested control flow statements. Open
if len(comments) > 1:
comments.append('')
return {'name': name,
Avoid deeply nested control flow statements. Open
if state:
changes = True
ret['result'] = True
else:
ret['comment'] = 'Target Group {0} failed to add targets'.format(name)
Avoid deeply nested control flow statements. Open
if __opts__['test']:
ret['comment'] = 'Org {0} user {1} will be ' \
'deleted'.format(name, username)
return ret
__salt__['grafana4.delete_org_user'](
Function activate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def activate(name):
'''
Install and activate the given product key
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
Avoid deeply nested control flow statements. Open
if 'pkgs' in chunk:
pkgs.extend(chunk['pkgs'])
chunk['__agg__'] = True
elif 'name' in chunk:
version = chunk.pop('version', None)
Function _fulfills_version_spec
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _fulfills_version_spec(versions, oper, desired_version,
ignore_epoch=False):
'''
Returns True if any of the installed versions match the specified version,
otherwise returns False
- 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
for pkgname, suggestions in \
six.iteritems(problems['suggest']):
comments.append(
'Package \'{0}\' not found (possible matches: '
'{1})'.format(pkgname, ', '.join(suggestions))
Function _find_advisory_targets
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _find_advisory_targets(name=None,
advisory_ids=None,
**kwargs):
'''
Inspect the arguments to pkg.patch_installed and discover what advisory
- 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 verify_result:
to_reinstall[package_name] = version_string
altered_files[package_name] = verify_result
continue
Avoid deeply nested control flow statements. Open
if sources:
pkgstr = reinstall_pkg
else:
pkgstr = _get_desired_pkg(reinstall_pkg, to_reinstall)
comment.append(
Avoid deeply nested control flow statements. Open
if resource_selector_property:
ret['comment'] = 'the {0} resource {1} is up to date.'.format(
resource_type,
resource_selector_value,
)
Avoid deeply nested control flow statements. Open
if 'resource_prune' in resource_cfg:
resource_prune = resource_cfg['resource_prune']
del resource_cfg['resource_prune']
if 'resource_selector_property' in resource_cfg:
Avoid deeply nested control flow statements. Open
if result:
ret['changes'][member] = {}
ret['changes'][member]['old'] = (
'User {0} is not in team {1}'.format(member, name))
ret['changes'][member]['new'] = (
Avoid deeply nested control flow statements. Open
if result:
ret['changes'][team_name] = team_change
else:
ret['result'] = False
ret['comment'] = ('Failed to remove repo {0} from team {1}.'