flavors/django-graphql-jwt

View on GitHub

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

def token_auth(f):
    @wraps(f)
    @setup_jwt_cookie
    def wrapper(cls, root, info, password, **kwargs):
        context = info.context
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 mutate_and_get_payload has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def mutate_and_get_payload(cls, root, info, token, **kwargs):
Severity: Minor
Found in graphql_jwt/relay.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 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 mutate has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def mutate(cls, root, info, token, **kwargs):
          Severity: Minor
          Found in graphql_jwt/mutations.py - About 35 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 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