Method index
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
use_session = !request.format.csv?
retrieve_query(UserQuery, use_session)
# API backwards compatibility: handle legacy filter parameters
Method update
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def update
is_updating_password = params[:user][:password].present? && (@user.auth_source_id.nil? || params[:user][:auth_source_id].blank?)
if is_updating_password
@user.password, @user.password_confirmation = params[:user][:password], params[:user][:password_confirmation]
end
- 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 create
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@user = User.new(:language => Setting.default_language,
:mail_notification => Setting.default_notification_option,
:admin => false)
@user.safe_attributes = params[:user]
Method create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create
@user = User.new(:language => Setting.default_language,
:mail_notification => Setting.default_notification_option,
:admin => false)
@user.safe_attributes = params[: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 update
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
is_updating_password = params[:user][:password].present? && (@user.auth_source_id.nil? || params[:user][:auth_source_id].blank?)
if is_updating_password
@user.password, @user.password_confirmation = params[:user][:password], params[:user][:password_confirmation]
end
Method index
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def index
use_session = !request.format.csv?
retrieve_query(UserQuery, use_session)
# API backwards compatibility: handle legacy filter parameters
- 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 destroy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def destroy
return render_error status: 422 if @user == User.current && !@user.own_account_deletable?
if api_request? || params[:lock] || params[:confirm] == @user.login
if params[:lock]
- 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 find_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_user(logged = true)
if params[:id] == 'current'
require_login || return
@user = User.current
elsif logged
- 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"