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)
- Read upRead up
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
Method resolve
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resolve(args)
user = context[:current_user]
if user.blank?
return {
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
- Read upRead up
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(args)
if lockable?
user = User.where(locked_at: nil).reset_password_by_token args
else
user = User.reset_password_by_token args
- Read upRead up
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"