zalando/connexion

View on GitHub

Showing 88 of 149 total issues

Function __call__ has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

    def __call__(self, function):
        """
        :type function: types.FunctionType
        :rtype: types.FunctionType
        """
Severity: Minor
Found in connexion/decorators/validation.py - About 1 day 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 security_decorator has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    def security_decorator(self):
        """
        Gets the security decorator for operation

        From Swagger Specification:
Severity: Minor
Found in connexion/operations/secure.py - About 6 hrs 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 coerce_type has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

def coerce_type(param, value, parameter_type, parameter_name=None):

    def make_type(value, type_literal):
        type_func = TYPE_MAP.get(type_literal)
        return type_func(value)
Severity: Minor
Found in connexion/decorators/validation.py - About 5 hrs 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

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

import abc
import logging
import pathlib
import sys
import warnings
Severity: Minor
Found in connexion/apis/abstract.py - About 5 hrs to fix

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

            def __call__(self, function):
                """
                :type function: types.FunctionType
                :rtype: types.FunctionType
                """
        Severity: Minor
        Found in connexion/decorators/validation.py - About 4 hrs 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

        File aiohttp_api.py has 333 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import asyncio
        import logging
        import re
        import traceback
        from contextlib import suppress
        Severity: Minor
        Found in connexion/apis/aiohttp_api.py - About 4 hrs to fix

          Function validate_required has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

          def validate_required(validator, required, instance, schema):
              if not validator.is_type(instance, "object"):
                  return
          
              for prop in required:
          Severity: Minor
          Found in connexion/json_schema.py - About 3 hrs 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

          File validation.py has 317 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import collections
          import copy
          import functools
          import logging
          
          
          Severity: Minor
          Found in connexion/decorators/validation.py - About 3 hrs to fix

            File openapi.py has 310 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import logging
            from copy import copy, deepcopy
            
            from connexion.operations.abstract import AbstractOperation
            
            
            Severity: Minor
            Found in connexion/operations/openapi.py - About 3 hrs to fix

              File security_handler_factory.py has 296 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import abc
              import base64
              import functools
              import logging
              import os
              Severity: Minor
              Found in connexion/security/security_handler_factory.py - About 3 hrs to fix

                Function parameter_to_arg has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                def parameter_to_arg(operation, function, pythonic_params=False,
                                     pass_context_arg_name=None):
                    """
                    Pass query and body parameters as keyword arguments to handler function.
                
                
                Severity: Minor
                Found in connexion/decorators/parameter.py - About 2 hrs 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

                AbstractSecurityHandlerFactory has 25 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class AbstractSecurityHandlerFactory(abc.ABC):
                    """
                    get_*_func -> _get_function -> get_function_from_name (name=security function defined in spec)
                        (if url defined instead of a function -> get_token_info_remote)
                
                
                Severity: Minor
                Found in connexion/security/security_handler_factory.py - About 2 hrs to fix

                  AbstractAPI has 24 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class AbstractAPI(metaclass=AbstractAPIMeta):
                      """
                      Defines an abstract interface for a Swagger API
                      """
                  
                  
                  Severity: Minor
                  Found in connexion/apis/abstract.py - About 2 hrs to fix

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

                        def __init__(self, api, method, path, operation, resolver, app_produces, app_consumes,
                    Severity: Major
                    Found in connexion/operations/swagger2.py - About 2 hrs to fix

                      File uri_parsing.py has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      # Decorators to split query and path parameters
                      import abc
                      import functools
                      import logging
                      import re
                      Severity: Minor
                      Found in connexion/decorators/uri_parsing.py - About 2 hrs to fix

                        Function validate_parameter has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def validate_parameter(parameter_type, value, param, param_name=None):
                                if value is not None:
                                    if is_nullable(param) and is_null(value):
                                        return
                        
                        
                        Severity: Minor
                        Found in connexion/decorators/validation.py - About 2 hrs 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 run has 19 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def run(spec_file,
                        Severity: Major
                        Found in connexion/cli.py - About 2 hrs to fix

                          File swagger2.py has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import logging
                          from copy import deepcopy
                          
                          from connexion.operations.abstract import AbstractOperation
                          
                          
                          Severity: Minor
                          Found in connexion/operations/swagger2.py - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language