Method login
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def login
# to force a redirect back to where the user was
# needed because the app would block a redirect since the auth is in an external url
params["return_to"] = user_return_to
- 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 login
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def login
# to force a redirect back to where the user was
# needed because the app would block a redirect since the auth is in an external url
params["return_to"] = user_return_to
Method associate_with_existent_account
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def associate_with_existent_account(shib)
# try to authenticate the user with his login and password
valid = false
if params.has_key?(:user)
- 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 associate_with_new_account
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def associate_with_new_account(shib)
token = shib.find_or_create_token()
# if there's already a user and an association, we don't need to do anything, just
# return and, when the user is redirected back to #login, the token will be checked again
Method associate_with_new_account
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def associate_with_new_account(shib)
token = shib.find_or_create_token()
# if there's already a user and an association, we don't need to do anything, just
# return and, when the user is redirected back to #login, the token will be checked again
- 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 associate_with_existent_account
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def associate_with_existent_account(shib)
# try to authenticate the user with his login and password
valid = false
if params.has_key?(:user)