zalando/connexion

View on GitHub

Showing 149 of 149 total issues

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/openapi3/sqlalchemy/orm.py - About 35 mins to fix

    Function resolve_form has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def resolve_form(self, form_data):
            if self._body_schema is None or self._body_schema.get('type') != 'object':
                return form_data
            for k in form_data:
                encoding = self._body_encoding.get(k, {"style": "form"})
    Severity: Minor
    Found in connexion/decorators/uri_parsing.py - About 35 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class NonConformingResponseBody(NonConformingResponse):
        def __init__(self, message, reason="Response body does not conform to specification"):
            super(NonConformingResponseBody, self).__init__(reason=reason, message=message)
    Severity: Minor
    Found in connexion/exceptions.py and 1 other location - About 35 mins to fix
    connexion/exceptions.py on lines 105..107

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 33.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function validate_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_response(self, data, status_code, headers, url):
            """
            Validates the Response object based on what has been declared in the specification.
            Ensures the response body matches the declated schema.
            :type data: dict
    Severity: Minor
    Found in connexion/decorators/response.py - About 35 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 _serialize_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _serialize_data(cls, data, mimetype):
            # TODO: Harmonize with flask_api. Currently this is the backwards compatible with aiohttp_api._cast_body.
            if not isinstance(data, bytes):
                if isinstance(mimetype, str) and is_json_mimetype(mimetype):
                    body = cls.jsonifier.dumps(data)
    Severity: Minor
    Found in connexion/apis/abstract.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def verify_security(cls, auth_funcs, required_scopes, function):
            @functools.wraps(function)
            def wrapper(request):
                token_info = None
                for func in auth_funcs:
    Severity: Minor
    Found in connexion/security/security_handler_factory.py - About 35 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 validate_server_requirements has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def validate_server_requirements(ctx, param, value):
        if value == 'gevent':
            try:
                import gevent  # NOQA
            except ImportError:
    Severity: Minor
    Found in connexion/cli.py - About 35 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def __init__(self, api, security, security_schemes):
            """
            :param security: list of security rules the application uses by default
            :type security: list
            :param security_definitions: `Security Definitions Object
    Severity: Minor
    Found in connexion/operations/secure.py and 1 other location - About 35 mins to fix
    connexion/decorators/validation.py on lines 31..42

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 33.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function resolve_operation_id_using_rest_semantics has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def resolve_operation_id_using_rest_semantics(self, operation):
            """
            Resolves the operationId using REST semantics
    
            :type operation: connexion.operations.AbstractOperation
    Severity: Minor
    Found in connexion/resolver.py - About 35 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 extend_with_set_default has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def extend_with_set_default(validator_class):
        validate_properties = validator_class.VALIDATORS['properties']
    
        def set_defaults(validator, properties, instance, schema):
            for property, subschema in six.iteritems(properties):
    Severity: Minor
    Found in examples/swagger2/enforcedefaults/enforcedefaults.py - About 35 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def __init__(self, schema_type, parameter_type, parameter_name):
            """
            Exception raise when type validation fails
    
            :type schema_type: str
    Severity: Minor
    Found in connexion/decorators/validation.py and 1 other location - About 35 mins to fix
    connexion/operations/secure.py on lines 13..23

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 33.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class NonConformingResponseHeaders(NonConformingResponse):
        def __init__(self, message, reason="Response headers do not conform to specification"):
            super(NonConformingResponseHeaders, self).__init__(reason=reason, message=message)
    Severity: Minor
    Found in connexion/exceptions.py and 1 other location - About 35 mins to fix
    connexion/exceptions.py on lines 100..102

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 33.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Avoid too many return statements within this function.
    Open

                return cls._build_response(mimetype=mimetype, data=response, extra_context=extra_context)
    Severity: Major
    Found in connexion/apis/abstract.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return (None, status_code)
      Severity: Major
      Found in connexion/operations/openapi.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return value
        Severity: Major
        Found in connexion/decorators/validation.py - About 30 mins to fix

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  try:
                      return (self._nested_example(deep_get(self._responses, schema_path)),
                              status_code)
                  except KeyError:
                      return (None, status_code)
          Severity: Minor
          Found in connexion/operations/swagger2.py and 1 other location - About 30 mins to fix
          connexion/operations/openapi.py on lines 209..213

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 32.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Avoid too many return statements within this function.
          Open

                          return cls._build_response(mimetype=mimetype, data=data, status_code=status_code, headers=headers, extra_context=extra_context)
          Severity: Major
          Found in connexion/apis/abstract.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return {}
            Severity: Major
            Found in connexion/operations/openapi.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return json.JSONEncoder.default(self, o)
              Severity: Major
              Found in connexion/jsonifier.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return json.JSONEncoder.default(self, o)
                Severity: Major
                Found in connexion/apps/flask_app.py - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language