Showing 14 of 50 total issues
Function jwt_required
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def jwt_required(
function=None, *, allow=None, deny=None, fresh_required=False,
):
def real(fn):
@wraps(fn)
- 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 create_access_token
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def create_access_token(
cls,
identity,
role=None,
fresh=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
Function create_refresh_token
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def create_refresh_token(
cls,
identity,
role=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
Function refresh_jwt_required
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def refresh_jwt_required(function=None, *, allow=None, deny=None):
def real(fn):
@wraps(fn)
async def wrapper(*args, **kwargs):
request = _get_request(args)
- 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 create_access_token
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_access_token(
Function _get_raw_jwt_from_request
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _get_raw_jwt_from_request(request, is_access=True):
functions: List[jwt_get_function] = []
for eligible_location in JWT.config.token_location:
if eligible_location == "header":
- 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 create_refresh_token
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_refresh_token(
Function _validate_config
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _validate_config(cls):
if cls.config.algorithm.startswith("HS") and not cls.config.secret_key:
raise ConfigurationConflictError(
"HS* algorithm needs secret key to encode token"
)
- 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 compare_digest
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def compare_digest(a, b):
if isinstance(a, str):
a = a.encode("utf-8")
if isinstance(b, str):
b = b.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 jwt_required
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def jwt_required(
Function _encode_jwt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _encode_jwt(cls, token_type, payload, expires_delta):
algorithm = cls.config.algorithm
secret = (
cls.config.secret_key
if algorithm.startswith("HS")
- 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_raw_jwt_from_cookies
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _get_raw_jwt_from_cookies(request, is_access):
cookie_key = JWT.config.jwt_cookie if is_access else JWT.config.refresh_jwt_cookie
csrf_header_key = (
JWT.config.jwt_csrf_header if is_access else JWT.config.refresh_jwt_csrf_header
)
- 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 __post_init__
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __post_init__(self):
self.raw_data = self._decode_jwt()
self.type = self._get_type()
self.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 _setup_blacklist
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _setup_blacklist(cls):
if cls.config.use_blacklist is True:
blacklist_cls = (
cls.config.blacklist_class
if cls.config.blacklist_class
- 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"