flavors/django-graphql-jwt

View on GitHub

Showing 10 of 18 total issues

Function resolve has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def resolve(self, next, root, info, **kwargs):
        context = info.context
        token_argument = get_token_argument(context, **kwargs)

        if jwt_settings.JWT_ALLOW_ARGUMENT and token_argument is None:
Severity: Minor
Found in graphql_jwt/middleware.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 jwt_cookie has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def jwt_cookie(view_func):
    @wraps(view_func)
    def wrapped_view(request, *args, **kwargs):
        request.jwt_cookie = True
        response = view_func(request, *args, **kwargs)
Severity: Minor
Found in graphql_jwt/decorators.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 wrapper has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def wrapper(cls, root, info, token=None, *args, **kwargs):
Severity: Minor
Found in graphql_jwt/decorators.py - About 45 mins to fix

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

        def wrapper(cls, root, info, refresh_token=None, *args, **kwargs):
    Severity: Minor
    Found in graphql_jwt/refresh_token/decorators.py - About 45 mins to fix

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

          def refresh(cls, root, info, token, **kwargs):
      Severity: Minor
      Found in graphql_jwt/mixins.py - About 35 mins to fix

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

            def wrapper(cls, root, info, *args, **kwargs):
        Severity: Minor
        Found in graphql_jwt/decorators.py - About 35 mins to fix

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

              def wrapper(cls, root, info, password, **kwargs):
          Severity: Minor
          Found in graphql_jwt/decorators.py - About 35 mins to fix

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

                def wrapper(cls, root, info, *args, **kwargs):
            Severity: Minor
            Found in graphql_jwt/decorators.py - About 35 mins to fix

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

                  def refresh(cls, root, info, refresh_token, **kwargs):
              Severity: Minor
              Found in graphql_jwt/refresh_token/mixins.py - About 35 mins to fix

                Function parent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def parent(self, path):
                        path = filter_strings(path)
                
                        for depth in range(len(path) - 1):
                            parent = path[:-1 - depth]
                Severity: Minor
                Found in graphql_jwt/path.py - About 25 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

                Severity
                Category
                Status
                Source
                Language