Showing 110 of 118 total issues
Function _build_paths
has a Cognitive Complexity of 122 (exceeds 5 allowed). Consider refactoring. Open
def _build_paths(self):
from slim.base.view import BaseView, AbstractSQLView
paths = {}
def returning_wrap(items_schema):
- 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 bind
has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring. Open
def bind(self, view: "AbstractSQLView"):
def check_column_exists(column):
if column is PRIMARY_KEY:
return
if column not in view.fields:
- 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
File sqlquery.py
has 568 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import logging
import traceback
from enum import Enum
from typing import Union, Iterable, List, TYPE_CHECKING, Dict, Set, Mapping
Function tokens_to_template
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
def tokens_to_template(tokens):
"""
Generate a function for templating tokens into a path string.
"""
def template_function(obj):
- 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
File abstract_sql_view.py
has 451 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import logging
from abc import abstractmethod
from typing import Tuple, Union, Dict, Iterable, Type, List, Optional, Mapping
Function get_cooldown_decorator
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def get_cooldown_decorator(aioredis_instance: object, default_unique_id_func=get_ip) -> object:
redis = aioredis_instance
def cooldown(interval_value_or_func, redis_key_template, *, unique_id_func=default_unique_id_func, cd_if_unsuccessed=None):
def wrapper(func):
- 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
File main.py
has 395 lines of code (exceeds 250 allowed). Consider refactoring. Open
# https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md
from copy import deepcopy
from typing import Type, TYPE_CHECKING
from slim.base.types import BuiltinInterface
Function check_query_permission_full
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def check_query_permission_full(self, user: "BaseUser", table: str, ability: "Ability", view: "AbstractSQLView", ignore_error=True):
from .permission import A
# QUERY 权限检查
# QUERY 的特殊之处在于即使没有查询条件也会查出数据
- 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 _bind
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def _bind(self):
from ._view.request_view import RequestView
from ._view.abstract_sql_view import AbstractSQLView
def add_to_url_mapping(_meta, _fullpath):
- 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 __exit__
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def __exit__(self, exc_type, exc_val: Exception, exc_tb):
# FinishQuitException
if isinstance(exc_val, FinishQuitException):
return True # Finished, do nothing
- 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
File base_view.py
has 347 lines of code (exceeds 250 allowed). Consider refactoring. Open
import asyncio
import json
import logging
import time
from collections import OrderedDict
Function build_headers
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def build_headers(self):
headers = [
# TODO: bytes convert cache
[const.CONTENT_TYPE.encode('utf-8'), self.content_type.encode('utf-8')]
]
- 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 createAPIRequester
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createAPIRequester (ctx) {
function getAccessToken () {
if (!ctx) {
return localStorage.getItem('t')
}
File web.py
has 343 lines of code (exceeds 250 allowed). Consider refactoring. Open
import asyncio
import hashlib
import logging
import os
import time
Function parse_load_fk
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def parse_load_fk(cls, data: Dict[str, List[Dict[str, object]]]) -> Dict[str, List[Dict[str, object]]]:
"""
:param data:{
<column>: role,
<column2>: role,
- 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 createAPIRequester
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
export function createAPIRequester (ctx) {
function getAccessToken () {
if (!ctx) {
return localStorage.getItem('t')
}
- 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_permission_value
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def _parse_permission_value(self, val) -> Set[str]:
"""
从 obj 中取出权限列表
:param val:
:return: {A.QUERY, A.WRITE, ...}
- 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 pack_headers
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def pack_headers(self, request: 'ASGIRequest'):
def solve(val):
if isinstance(val, str):
return val
elif isinstance(val, Iterable):
- 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 import_path
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def import_path(path, depth=-1):
if depth == 0:
return
for base_path in sys.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
Function query_path
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def query_path(self, method, path) -> Tuple[Union[RouteInterfaceInfo, RouteStaticsInfo, None], Optional[Dict]]:
"""
Get route info for specified method and path.
:param method:
:param 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"