zalando/connexion

View on GitHub

Showing 149 of 149 total issues

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

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

class AuthenticationProblem(ProblemException):

    def __init__(self, status, title, detail):
        super(AuthenticationProblem, self).__init__(status=status, title=title, detail=detail)
Severity: Minor
Found in connexion/exceptions.py and 1 other location - About 45 mins to fix
connexion/exceptions.py on lines 82..85

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 35.

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 __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

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

              class ResolverProblem(ProblemException):
              
                  def __init__(self, status, title, detail):
                      super(ResolverProblem, self).__init__(status=status, title=title, detail=detail)
              Severity: Minor
              Found in connexion/exceptions.py and 1 other location - About 45 mins to fix
              connexion/exceptions.py on lines 76..79

              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 35.

              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 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

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

                          def __init__(self,
                      Severity: Minor
                      Found in connexion/lifecycle.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):  # pragma: no cover
                        Severity: Minor
                        Found in connexion/apps/abstract.py - About 35 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

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

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

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

                                  def __init__(self, formdata_parameters, query_parameters, title=None, detail=None, **kwargs):
                              Severity: Minor
                              Found in connexion/exceptions.py - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language