zalando/connexion

View on GitHub

Showing 88 of 149 total issues

Function add_paths has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def add_paths(self, paths=None):
        """
        Adds the paths defined in the specification as endpoints

        :type paths: list
Severity: Minor
Found in connexion/apis/abstract.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

File flask_api.py has 259 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
import warnings

import flask
import werkzeug.exceptions
Severity: Minor
Found in connexion/apis/flask_api.py - About 2 hrs to fix

    Function _get_body_argument has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_body_argument(self, body, arguments, has_kwargs, sanitize):
            kwargs = {}
            body_parameters = [p for p in self.parameters if p['in'] == 'body'] or [{}]
            if body is None:
                body = deepcopy(body_parameters[0].get('schema', {}).get('default'))
    Severity: Minor
    Found in connexion/operations/swagger2.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 resolve_refs has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def resolve_refs(spec, store=None, handlers=None):
        """
        Resolve JSON references like {"$ref": <some URI>} in a spec.
        Optionally takes a store, which is a mapping from reference URLs to a
        dereferenced objects. Prepopulating the store can avoid network calls.
    Severity: Minor
    Found in connexion/json_schema.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 __init__ has 15 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

      Function get_function_from_name has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_function_from_name(function_name):
          """
          Tries to get function by fully qualified name (e.g. "mymodule.myobj.myfunc")
      
          :type function_name: str
      Severity: Minor
      Found in connexion/utils.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 __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 __init__ has 13 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, specification, base_path=None, arguments=None,
        Severity: Major
        Found in connexion/apis/abstract.py - About 1 hr to fix

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

              def __init__(self, import_name, api_cls, port=None, specification_dir='',
          Severity: Major
          Found in connexion/apps/abstract.py - About 1 hr to fix

            Function run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            def run(spec_file,
                    base_module_path,
                    port,
                    host,
                    wsgi_server,
            Severity: Minor
            Found in connexion/cli.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 verify_api_key has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def verify_api_key(self, api_key_info_func, loc, name):
                    check_api_key_func = self.check_api_key(api_key_info_func)
            
                    def wrapper(request, required_scopes):
            
            
            Severity: Minor
            Found in connexion/security/security_handler_factory.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 run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def run(self, port=None, server=None, debug=None, host=None, **options):  # pragma: no cover
                    """
                    Runs the application on a local development server.
                    :param host: the host interface to bind on.
                    :type host: str
            Severity: Minor
            Found in connexion/apps/flask_app.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 _response_from_handler has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def _response_from_handler(cls, response, mimetype, extra_context=None):
                    """
                    Create a framework response from the operation handler data.
                    An operation handler can return:
                    - a framework response
            Severity: Minor
            Found in connexion/apis/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 add_api has 12 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def add_api(self, specification, base_path=None, arguments=None,
            Severity: Major
            Found in connexion/apps/abstract.py - About 1 hr to fix

              Function deep_merge has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              def deep_merge(a, b):
                  """ merges b into a
                      in case of conflict the value from b is used
                  """
                  for key in b:
              Severity: Minor
              Found in connexion/utils.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 __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self,
              Severity: Major
              Found in connexion/lifecycle.py - About 1 hr to fix

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

                    def _get_typed_body_values(self, body_arg, body_props, additional_props):
                        """
                        Return a copy of the provided body_arg dictionary
                        whose values will have the appropriate types
                        as defined in the provided schemas.
                Severity: Minor
                Found in connexion/operations/openapi.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 resolve_params has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def resolve_params(self, params, _in):
                        """
                        takes a dict of parameters, and resolves the values into
                        the correct array type handling duplicate values, and splitting
                        based on the collectionFormat defined in the spec.
                Severity: Minor
                Found in connexion/decorators/uri_parsing.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 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 yamldumper has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                def yamldumper(openapi):
                    """
                    Returns a nicely-formatted yaml spec.
                    :param openapi: a spec dictionary.
                    :return: a nicely-formatted, serialized yaml spec.
                Severity: Minor
                Found in connexion/utils.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

                Severity
                Category
                Status
                Source
                Language