Showing 139 of 218 total issues
Function _share_local_dir
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _share_local_dir(self, lpath, rpath, fast):
result = const.ENoError
for walk in self._walk_normal_file(lpath):
(dirpath, dirnames, filenames) = walk
for filename in filenames:
- 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 _down_aria2c
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _down_aria2c(self, remotefile, localfile):
url = "{}{}".format(dpcsurl, "file")
# i think encoding in UTF-8 before escaping is presumably the best practice
# http://stackoverflow.com/a/913653/404271
pars = {
- 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 mppprgr
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def mppprgr(finish, total, start_time = None, existing = 0,
Function pprgr
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def pprgr(finish, total, start_time = None, existing = 0,
Function _stream_upload
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _stream_upload(self, fo, pars, act, remotepath,
Function request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def request(cls, method, url, **kwargs):
"""
:type method: str
"""
methodupper = method.upper()
- 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 os.path.exists(p):
files[f] = oldfiles[f]
else:
if cached.verbose:
needclean = True
Function interpret_size
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def interpret_size(si):
'''
>>> interpret_size(10)
10
>>> interpret_size('10')
- 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 plog
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def plog(tag, msg, showtime = True, showdate = False,
prefix = '', suffix = '', fg = TermColor.Nil, bg = TermColor.Nil):
if showtime or showdate:
now = time.localtime()
if showtime:
- 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 _rapidupload_file_post
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _rapidupload_file_post(self, rpath, size, md5str, slicemd5str, crcstr, ondup = 'overwrite'):
Avoid deeply nested control flow statements. Open
if helpline.find('help') == 0:
summary.insert(0, helpline)
else:
summary.append(helpline)
#commands.append(v.__name__) # append command name
Function _str
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _str(self, prefix):
result = ''
for k, v in self.items():
result += "{} - {}/{} - size: {} - md5: {}\n".format(
v.type, prefix, k,
- 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 _downfile_act
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _downfile_act(self, r, args):
rfile, offset = args
with io.open(self._current_file, 'r+b' if offset > 0 else 'wb') as f:
if offset > 0:
f.seek(offset)
- 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 clean_prog_files
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def clean_prog_files(cleanlevel, verbose, configdir = const.ConfigDir):
tokenpath = os.path.join(configdir, const.TokenFileName)
result = removefile(tokenpath, verbose)
if result == const.ENoError:
pr("Token file '{}' removed. You need to re-authorize "
- 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 _panapi_revision_list_act
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _panapi_revision_list_act(self, r, args):
j = r.json()
self.pd("RevisionList response: {}".format(j))
if j['errno'] == 0:
if 'list' in j:
- 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 remove
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def remove(path):
def notfound():
pdbg("Failed to delete cache: Path '{}' not found in cache.".format(path))
dir, file = os.path.split(path)
- 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 cached.ishexchar(c):
return True
return False
Function getmeta
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def getmeta(path, encoding = 'utf8'):
with io.open(path, encoding = encoding) as fp:
content = fp.read()
metakeys = ['title', 'version', 'desc', 'author', 'license', 'url']
metatrans = {'title': 'name', 'desc': 'description'}
- 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
Consider simplifying this complex logical expression. Open
if (r.status_code != 200 and r.status_code != 206) \
or (not ('method' in pars and pars['method'] == 'download') \
and url.find('method=download') == -1 \
and url.find('baidupcs.com/file/') == -1):
self._print_error_json(r)
Function _dump_exception
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _dump_exception(self, ex, url, pars, r, act):