Method lost_password
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def lost_password
(redirect_to(home_url); return) unless Setting.lost_password?
if prt = (params[:token] || session[:password_recovery_token])
@token = Token.find_token("recovery", prt.to_s)
if @token.nil?
- 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
File account_controller.rb
has 338 lines of code (exceeds 250 allowed). Consider refactoring. Open
class AccountController < ApplicationController
helper :custom_fields
include CustomFieldsHelper
self.main_menu = false
Class AccountController
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class AccountController < ApplicationController
helper :custom_fields
include CustomFieldsHelper
self.main_menu = false
Method lost_password
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
def lost_password
(redirect_to(home_url); return) unless Setting.lost_password?
if prt = (params[:token] || session[:password_recovery_token])
@token = Token.find_token("recovery", prt.to_s)
if @token.nil?
Method register
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def register
(redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration]
if !request.post?
session[:auth_source_registration] = nil
@user = User.new(:language => current_language.to_s)
- 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 register
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def register
(redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration]
if !request.post?
session[:auth_source_registration] = nil
@user = User.new(:language => current_language.to_s)
Method password_authentication
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def password_authentication
user = User.try_to_login!(params[:username], params[:password], false)
if user.nil?
invalid_credentials
- 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 activate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def activate
(redirect_to(home_url); return) unless Setting.self_registration? && params[:token].present?
token = Token.find_token('register', params[:token].to_s)
(redirect_to(home_url); return) unless token and !token.expired?
user = token.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
Avoid too many return
statements within this method. Open
return
Avoid too many return
statements within this method. Open
return
Avoid too many return
statements within this method. Open
return
Avoid too many return
statements within this method. Open
return
Avoid too many return
statements within this method. Open
return
Avoid too many return
statements within this method. Open
return
Avoid too many return
statements within this method. Open
return