Showing 62 of 92 total issues
Function _build_and_sign_url
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _build_and_sign_url(self, http_method: str, obj_name: str, content_md5: str='',
Function build_signed_url
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_signed_url(self, method, url, data=None, params=None, ttl=100, **kwargs):
Avoid deeply nested control flow statements. Open
if marker['name'] == subdir_path:
data.remove(marker)
break
Avoid deeply nested control flow statements. Open
for key, value in headers.items():
self.set_header(key, value)
finish_args = [exc.data]
Function add_file
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_file(self, field_name, file_stream, file_name=None, mime='application/octet-stream',
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, path,
Function throttle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def throttle(concurrency=10, interval=1):
def _throttle(func):
@functools.wraps(func)
async def wrapped(*args, **kwargs):
if asyncio.get_event_loop() not in _THROTTLES:
- 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 __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, auth: dict,
Function make_provider
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def make_provider(name: str, auth: dict, credentials: dict, settings: dict, **kwargs):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, raw, path, host=None, owner=None, repo=None):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, fmt=None, datefmt=None, style='%', pattern=None, mask='***'):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function build_signed_url
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_signed_url(self, method, url, data=None, params=None, ttl=100, **kwargs):
signer = signing.Signer(settings.HMAC_SECRET, settings.HMAC_ALGORITHM)
if method.upper() in QUERY_METHODS:
signed = signing.sign_data(signer, params or {}, ttl=ttl)
params = signed
- 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 adhoc_file_backend
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def adhoc_file_backend(func, was_bound=False, basepath=None):
basepath = basepath or settings.ADHOC_BACKEND_PATH
@functools.wraps(func)
def wrapped(task, *args, **kwargs):
- 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 __del__
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __del__(self):
"""
Manually close all sessions created during the life of the provider instance. Our code are
a slightly modified version of how ``aiohttp-3.5.4`` closes sessions and connectors.
- 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 write_error
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def write_error(self, status_code, exc_info):
sentry_sdk.capture_exception(exc_info)
etype, exc, _ = exc_info
if issubclass(etype, exceptions.PluginError):
- 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 parse_request_range
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_request_range(range_header):
r"""WB uses tornado's ``httputil._parse_request_range`` function to parse the Range HTTP header
and return a tuple representing the range. Tornado's version returns a tuple suitable for
slicing arrays, meaning that a range of 0-1 will be returned as ``(0, 2)``. WB had been
assuming that the tuple would represent the first and last byte positions and was consistently
- 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 __init__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, file_tuple):
filename, stream = file_tuple
# Build a ZipInfo instance to use for the file's header and footer
self.zinfo = zipfile.ZipInfo(
- 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 async_retry
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def async_retry(retries=5, backoff=1, exceptions=(Exception, )):
def _async_retry(func):
@as_task
- 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 generic_path_validation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def generic_path_validation(cls, path: str) -> None:
"""Validates a WaterButler specific path, e.g. /folder/file.txt, /folder/
:param str path: WaterButler path
"""
if not 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"