zalando/connexion

View on GitHub

Showing 88 of 149 total issues

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

    def _prepare_body_and_status_code(cls, data, mimetype, status_code=None, extra_context=None):
        if data is NoContent:
            data = None

        if status_code is None:
Severity: Minor
Found in connexion/apis/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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, status=400, title=None, detail=None, type=None,
Severity: Major
Found in connexion/exceptions.py - About 50 mins to fix

    Function problem has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def problem(status, title, detail, type=None, instance=None, headers=None, ext=None):
    Severity: Major
    Found in connexion/problem.py - About 50 mins to fix

      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 from_spec has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def from_spec(cls, spec, api, path, method, resolver, *args, **kwargs):
        Severity: Major
        Found in connexion/operations/swagger2.py - About 50 mins to fix

          Function from_spec has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def from_spec(cls, spec, api, path, method, resolver, *args, **kwargs):
          Severity: Major
          Found in connexion/operations/openapi.py - About 50 mins to fix

            Function _generic_check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def _generic_check(self, func, exception_msg):
                    need_to_add_context, need_to_add_required_scopes = self._need_to_add_context_or_scopes(func)
            
                    def wrapper(request, *args, required_scopes=None):
                        kwargs = {}
            Severity: Minor
            Found in connexion/security/security_handler_factory.py - About 45 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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, schema, consumes, api, is_null_value_valid=False, validator=None,
            Severity: Minor
            Found in connexion/decorators/validation.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if 'x-writeOnly' in validator.VALIDATORS and subschema.get('x-writeOnly') is True:
                                      continue
                          yield ValidationError("%r is a required property" % prop)
              Severity: Major
              Found in connexion/json_schema.py - About 45 mins to fix

                Function _build_response has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def _build_response(cls, data, mimetype, content_type=None, headers=None, status_code=None, extra_context=None):
                Severity: Minor
                Found in connexion/apis/aiohttp_api.py - About 45 mins to fix

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

                      def run(self, port=None, server=None, debug=None, host=None, **options):
                          if port is not None:
                              self.port = port
                          elif self.port is None:
                              self.port = 5000
                  Severity: Minor
                  Found in connexion/apps/aiohttp_app.py - About 45 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

                  Avoid deeply nested control flow statements.
                  Open

                                      if 'writeOnly' in validator.VALIDATORS and subschema.get('writeOnly'):
                                          continue
                                      if 'x-writeOnly' in validator.VALIDATORS and subschema.get('x-writeOnly') is True:
                  Severity: Major
                  Found in connexion/json_schema.py - About 45 mins to fix

                    Function _build_response has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def _build_response(cls, mimetype, content_type=None, headers=None, status_code=None, data=None, extra_context=None):
                    Severity: Minor
                    Found in connexion/apis/flask_api.py - About 45 mins to fix

                      Function _build_response has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def _build_response(cls, data, mimetype, content_type=None, status_code=None, headers=None, extra_context=None):
                      Severity: Minor
                      Found in connexion/apis/abstract.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if 'readOnly' in validator.VALIDATORS and subschema.get('readOnly'):
                                                continue
                                            if 'writeOnly' in validator.VALIDATORS and subschema.get('writeOnly'):
                        Severity: Major
                        Found in connexion/json_schema.py - About 45 mins to fix

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

                              def _get_body_argument(self, body, arguments, has_kwargs, sanitize):
                                  x_body_name = sanitize(self.body_schema.get('x-body-name', 'body'))
                                  if is_nullable(self.body_schema) and is_null(body):
                                      return {x_body_name: None}
                          
                          
                          Severity: Minor
                          Found in connexion/operations/openapi.py - About 45 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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def __init__(self, api, status_code, exception, security, security_definitions):
                          Severity: Minor
                          Found in connexion/handlers.py - About 35 mins to fix

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

                                def run(self, port=None, server=None, debug=None, host=None, **options):
                            Severity: Minor
                            Found in connexion/apps/aiohttp_app.py - About 35 mins to fix

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

                                  def update(self, id=None, name=None, animal_type=None, tags=None, created=None):
                              Severity: Minor
                              Found in examples/swagger2/sqlalchemy/orm.py - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language