o2web/graphql-auth

View on GitHub

Showing 5 of 7 total issues

Method current_user has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def current_user
      authorization_token = request.headers['Authorization']
      return nil if authorization_token.nil?

      decrypted_token = GraphQL::Auth::JwtManager.decode(authorization_token)
Severity: Minor
Found in app/helpers/graphql/auth_helper.rb - About 1 hr 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

Method resolve has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def resolve(email:, password:, remember_me:)
    response = context[:response]

    if lockable?
      user = User.where(locked_at: nil).find_by email: email
Severity: Minor
Found in app/graphql/mutations/auth/sign_in.rb - About 1 hr to fix

    Method resolve has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def resolve(args)
        user = context[:current_user]
    
        if user.blank?
          return {
    Severity: Minor
    Found in app/graphql/mutations/auth/update_account.rb - About 1 hr to fix

      Method resolve has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def resolve(args)
          if lockable?
            user = User.where(locked_at: nil).reset_password_by_token args
          else
            user = User.reset_password_by_token args
      Severity: Minor
      Found in app/graphql/mutations/auth/reset_password.rb - 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

      Method resolve has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def resolve(email:, password:, remember_me:)
          response = context[:response]
      
          if lockable?
            user = User.where(locked_at: nil).find_by email: email
      Severity: Minor
      Found in app/graphql/mutations/auth/sign_in.rb - 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

      Severity
      Category
      Status
      Source
      Language