Showing 9,400 of 17,590 total issues
Avoid deeply nested control flow statements. Open
if line.startswith('zone_info=GMT'):
return 'UTC'
return 'localtime'
Function ls
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ls(path, load_path=None): # pylint: disable=C0103
'''
List the direct children of a node
CLI Example:
- 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 'UTC=' in line:
is_utc = line.rstrip('\n').split('=')[-1].lower()
if is_utc == 'yes':
return 'UTC'
else:
Avoid deeply nested control flow statements. Open
if match:
self.data.append(('', match[0][0]))
else:
Avoid deeply nested control flow statements. Open
if '='.join(line[1:]).strip() != item.strip():
changes['edited'].append(
({line[0]: line[1:]}, {key: item}))
break
if not matched:
Avoid deeply nested control flow statements. Open
if os.path.isfile(repo_file):
msg = ('File {1} containing repo \'{0}\' has been '
'removed.')
try:
os.remove(repo_file)
Avoid deeply nested control flow statements. Open
if state not in docs:
if hasattr(st_.states[fun], '__globals__'):
docs[state] = st_.states[fun].__globals__['__doc__']
docs[fun] = st_.states[fun].__doc__
Avoid deeply nested control flow statements. Open
if target is None:
errors.append(
'No version matching \'{0}{1}\' could be found '
'(available: {2})'.format(
pkgname,
Avoid deeply nested control flow statements. Open
if out['retcode']:
raise CommandExecutionError(
'Unable to add PPA \'{0}\'. \'{1}\' exited with '
'status {2!s}: \'{3}\' '.format(
repo[4:],
Function put_website
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def put_website(Bucket, ErrorDocument=None, IndexDocument=None,
RedirectAllRequestsTo=None, RoutingRules=None,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, update the website configuration for a bucket.
- 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 _latest_version == _version:
_refresh_db = True
else:
Avoid deeply nested control flow statements. Open
for comp in repo_comps:
if comp in sub.get('comps', []):
return sub
return {}
Function list_objects
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def list_objects(Bucket, Delimiter=None, EncodingType=None, Prefix=None,
FetchOwner=False, StartAfter=None, region=None, key=None,
keyid=None, profile=None):
'''
List objects in a given S3 bucket.
- 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 repo_comps:
return sub
for comp in repo_comps:
Avoid deeply nested control flow statements. Open
if not source.comps:
try:
sources.remove(source)
except ValueError:
pass
Avoid deeply nested control flow statements. Open
if comp or (not comp and isinstance(comp, list)):
diffdict.update({i: defined[i]})
return diffdict
Avoid deeply nested control flow statements. Open
if candidate.lower() == '(none)':
candidate = ''
break
Avoid deeply nested control flow statements. Open
if refresh:
refresh_db()
return {repo: out}
Avoid deeply nested control flow statements. Open
if result['retcode'] != 0:
log.error(
'failed to set state %s for package %s',
_state, _pkg
)
Avoid deeply nested control flow statements. Open
if return_old_value:
d_in_e.append(comp['new'])
else:
d_in_e.append(comp)
if all(d_in_e):