Showing 23 of 23 total issues
Method after_save
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def after_save(record)
return unless record.account && record.account_id_changed?
record.account.users.each do |account_user|
next if account_user == record # don't get notified when I join
Notification::NewUser.create!(recipient:account_user, subject:record)
- 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 set_category_from_params_and_angle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_category_from_params_and_angle
session[:ideas_category] ||= {}
params[:category] =
session[:ideas_category][@angle] = begin
valid_categories = (current_user.account.andand.categories || []) + %w(all none)
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def create
idea = current_account.ideas.find(params[:user_bookmark][:idea_id])
@user_bookmark = current_user.bookmarks.new(idea: idea)
if @user_bookmark.save
flash[:success] = _('Bookmark successfuly added.')
- 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"