Method update
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
def update
valid_password_confirmation
session[:show_dashboard_details_flash] = params[:show_dashboard_details_flash].present?
session[:show_account_settings_flash] = params[:show_account_settings_flash].present?
- 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 a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def create
@user = ::User.new
# Validation is done on params to allow checking the change of the value.
# The error is deferred to display values in the form in the error scenario.
- 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 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@user = ::User.new
# Validation is done on params to allow checking the change of the value.
# The error is deferred to display values in the form in the error scenario.
Method update
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
valid_password_confirmation
session[:show_dashboard_details_flash] = params[:show_dashboard_details_flash].present?
session[:show_account_settings_flash] = params[:show_account_settings_flash].present?
Method destroy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def destroy
valid_password_confirmation
raise "Can't delete user. Has shared entities" if @user.has_shared_entities?
@user.destroy
- 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"