Showing 110 of 118 total issues
Function do_request
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def do_request(config, method, url, params=None, post_data=None, role=None, access_token=None, *,
Function interface
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def interface(self, method, url=None, *, summary=None, va_query=None, va_post=None, va_headers=None,
Function _polyfill_post
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _polyfill_post(request: 'web.Request', post):
if post:
if isinstance(post, bytes):
request._read_bytes = post
else:
- 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 check_insert_permission
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check_insert_permission(self, user: "BaseUser", table: str, ability: "Ability"):
from .permission import A
columns = self.keys()
logger.debug('request permission as %r: [%s] of table %r, columns: %s' % (ability.role, A.CREATE, table, columns))
is_empty_input = not columns
- 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 setup_extra_query_conditions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def setup_extra_query_conditions(self, user, table, query: 'SQLQueryInfo', view: "AbstractSQLView"):
if table in self.query_condition_params:
# TODO: Check once
for items in self.query_condition_params[table]:
query.add_condition(*items)
- 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
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def get(self, url=None, *, summary=None, va_query=None, va_post=None, va_headers=None,
Function post
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def post(self, url=None, *, summary=None, va_query=None, va_post=None, va_headers=None,
Function can_with_record
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def can_with_record(self, user, action, record: DataRecord, *, available=None) -> set:
"""
进行基于 Record 的权限判定,返回可用列。
:param user:
:param action:
- 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 do_request
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def do_request(config, method, url, params=None, post_data=None, role=None, access_token=None, *,
request_func=requests.request):
headers = {}
if params is None:
params = {}
- 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_order
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_order(text):
"""
:param text: order=id.desc, xxx.asc
:return: [
[<column>, asc|desc|default],
- 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 new
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def new(cls, username, password, *, email=None, nickname=None, is_for_tests=False) -> Optional['User']:
Function teardown_user_token
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def teardown_user_token(self: Union['BaseUserViewMixin', 'BaseView'], token=sentinel):
""" signout, invalidate the token here """
u = self.current_user
if u:
if token is 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 i.builtin_interface == BuiltinInterface.LIST:
parameters.extend([
{
"name": "page",
"in": "path",
Function __new__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __new__(cls, val):
if isinstance(val, (memoryview, bytes)):
return val
# FIX: 其实这可能有点问题,因为None是一个合法的值
if val is 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
for j in call_kwargs.keys() - route_info.names_include:
del call_kwargs[j]
# build a view instance
view = await route_info.view_cls._build(app, request)
Avoid deeply nested control flow statements. Open
if isinstance(items, (List, Tuple)):
for i in items:
write_values.append(do_validate(va_write_value, i, InvalidPostData))
else:
raise InvalidPostData("`items` from post data should be list")
Avoid deeply nested control flow statements. Open
if not ignore_exists:
raise e
return items
Avoid deeply nested control flow statements. Open
if sql_query:
parameters.extend(view_info['sql_query_parameters'])
Avoid deeply nested control flow statements. Open
if route_info.names_varkw is not None:
for j in route_info.names_exclude:
if j in call_kwargs:
del call_kwargs[j]
Avoid deeply nested control flow statements. Open
if i.builtin_interface == BuiltinInterface.SET:
if view_info['sql_cant_write']:
continue
add_bulk_header()
add_returning_header()