zalando/connexion

View on GitHub

Showing 88 of 149 total issues

Avoid too many return statements within this function.
Open

            return make_type(value, param_type)
Severity: Major
Found in connexion/decorators/validation.py - About 30 mins to fix

    Function _get_query_defaults has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_query_defaults(self, query_defns):
            defaults = {}
            for k, v in query_defns.items():
                try:
                    if v["schema"]["type"] == "object":
    Severity: Minor
    Found in connexion/operations/openapi.py - About 25 mins to fix

    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 __call__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def __call__(self, environ, start_response):
            logging.warning(
                "this demo is not secure by default!! "
                "You'll want to make sure these headers are coming from your proxy, "
                "and not directly from users on the web!"
    Severity: Minor
    Found in examples/openapi3/reverseproxy/app.py - About 25 mins to fix

    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_problem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def _generic_problem(http_status: HTTPStatus, exc: Exception = None):
        extra = None
        if exc is not None:
            loop = asyncio.get_event_loop()
            if loop.get_debug():
    Severity: Minor
    Found in connexion/apis/aiohttp_api.py - About 25 mins to fix

    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 default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def default(self, o):
            if isinstance(o, datetime.datetime):
                if o.tzinfo:
                    # eg: '2015-09-25T23:14:42.588601+00:00'
                    return o.isoformat('T')
    Severity: Minor
    Found in connexion/apps/flask_app.py - About 25 mins to fix

    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 verify_security has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def verify_security(cls, auth_funcs, required_scopes, function):
            @functools.wraps(function)
            async def wrapper(request):
                token_info = None
                for func in auth_funcs:
    Severity: Minor
    Found in connexion/security/async_security_handler_factory.py - About 25 mins to fix

    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 default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def default(self, o):
            if isinstance(o, datetime.datetime):
                if o.tzinfo:
                    # eg: '2015-09-25T23:14:42.588601+00:00'
                    return o.isoformat('T')
    Severity: Minor
    Found in connexion/jsonifier.py - About 25 mins to fix

    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_request_life_cycle_wrapper has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_request_life_cycle_wrapper(function, api, mimetype):
        """
        It is a wrapper used on `RequestResponseDecorator` class.
        This function is located in an extra module because python2.7 don't
        support the 'yield from' syntax. This function is used to await
    Severity: Minor
    Found in connexion/decorators/coroutine_wrappers.py - About 25 mins to fix

    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

    Severity
    Category
    Status
    Source
    Language