File generator.py
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
import inspect
import warnings
from itertools import groupby
from typing import Any
from typing import Dict
Function build_schema
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def build_schema(self, type_info: TypeInfo, *, output: bool) -> Schema:
if type_info.type_ == DataTypes.ANY:
return Schema(
description='Can be any value - string, number, boolean, array or object.',
nullable=type_info.nullable,
- 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 determine_path_prefix
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def determine_path_prefix(url_paths: List[str]) -> str:
"""
https://github.com/encode/django-rest-framework/blob/master/LICENSE.md
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- 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 generate_openapi
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def generate_openapi(
title: str,
version: str,
routes: Sequence[Route],
description: Optional[str] = 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 get_schema_or_reference
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_schema_or_reference(self, type_info: Union[Type, TypeInfo], output: bool) -> Union[Schema, Reference]:
if not isinstance(type_info, TypeInfo):
type_info = inspect_type(type_info)
schema = self._schemas.get((type_info.hint_class, output))
if not 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 generate_openapi
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def generate_openapi(
Function _get_openapi_path
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _get_openapi_path(
Function _get_openapi_operation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _get_openapi_operation(