zalando/connexion

View on GitHub
connexion/operations/abstract.py

Summary

Maintainability
D
1 day
Test Coverage

File abstract.py has 376 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import abc
import logging

from connexion.operations.secure import SecureOperation

Severity: Minor
Found in connexion/operations/abstract.py - About 5 hrs to fix

    AbstractOperation has 35 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class AbstractOperation(SecureOperation, metaclass=abc.ABCMeta):
    
        """
        An API routes requests to an Operation by a (path, method) pair.
        The operation uses a resolver to resolve its handler function.
    Severity: Minor
    Found in connexion/operations/abstract.py - About 4 hrs to fix

      Function __init__ has 14 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, api, method, path, operation, resolver,
      Severity: Major
      Found in connexion/operations/abstract.py - About 1 hr to fix

        Function function has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def function(self):
                """
                Operation function with decorators
        
                :rtype: types.FunctionType
        Severity: Minor
        Found in connexion/operations/abstract.py - About 1 hr 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 _query_args_helper has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def _query_args_helper(self, query_defns, query_arguments,
                                   function_arguments, has_kwargs, sanitize):
                res = {}
                for key, value in query_arguments.items():
                    key = sanitize(key)
        Severity: Minor
        Found in connexion/operations/abstract.py - About 55 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_arguments has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def get_arguments(self, path_params, query_params, body, files, arguments,
        Severity: Major
        Found in connexion/operations/abstract.py - About 50 mins to fix

          Function _query_args_helper has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def _query_args_helper(self, query_defns, query_arguments,
          Severity: Minor
          Found in connexion/operations/abstract.py - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status