Showing 213 of 251 total issues
Method update_locale_cookie
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_locale_cookie
cookies[:locale] = secure_locale_param if params[:locale].present?
cookies[:locale] = nil if params[:locale] and params[:locale] == ""
cookies[:locale] = nil if cookies[:locale] == ""
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 destroy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def destroy
authorize! :update, parent
link = object.links_as_child.find_by(ancestor_id: parent.id, ancestor_type: parent.class.base_class.name)
link.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"
Further reading
Method permitted_group_attributes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def permitted_group_attributes
permitted_keys = []
permitted_keys += [:name, :extensive_name] if can? :rename, @group
permitted_keys += [:token] if can? :change_token, @group
permitted_keys += [:internal_token] if can? :change_internal_token, @group
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def create
if params[:invalid_email].present?
email_field = ProfileFields::Email.where(value: params[:invalid_email]).first
if email_field
email_field.needs_review!
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def create
authorize! :add_group_member_manually, group
raise ActionController::ParameterMissing, 'No user title given' unless membership_params[:user_title].present?
raise ActionController::ParameterMissing, 'User not found' unless 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 new_value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def new_value
value = params[:rails_settings_scoped_settings].try(:[], :value)
value ||= params['rails_settings/settings'].try(:[], :value)
value ||= params[:setting].try(:[], :value)
value ||= params[:value]
- 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 send_file_with_range
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def send_file_with_range(path, options = {})
if File.exist?(path)
size = File.size(path)
if !request.headers["Range"]
status_code = 200 # 200 OK
- 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 current_logo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def current_logo(key = nil)
logos = if current_home_page
Attachment.where(parent_type: 'Page', parent_id: [current_home_page.id] + current_home_page.child_pages.pluck(:id)).logos
else
Attachment.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 accept_terms_of_use
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def accept_terms_of_use
if current_user && current_user.account && (not read_only_mode?) && (not controller_name.in?(['terms_of_use', 'sessions', 'passwords', 'user_accounts', 'attachments', 'errors'])) && (not TermsOfUseController.accepted?(current_user))
if request.url.include?('redirect_after')
redirect_after = root_path
else
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def find_user
if not handle_mystery_user
@user = User.find(params[:id]) if params[:id].present?
@user ||= User.find_by_alias(params[:alias]) if params[:alias].present?
@user ||= User.new
- 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 t :events
Avoid too many return
statements within this method. Open
return ''
Avoid too many return
statements within this method. Open
return 'deceased_member' if deceased_member?
Avoid too many return
statements within this method. Open
return t :all_events if @all
Avoid too many return
statements within this method. Open
return 'full_member' if full_member?
Avoid too many return
statements within this method. Open
return ['global_officer', 'user', 'public'] if global_officer?
Avoid too many return
statements within this method. Open
return 'former_member' if former_member?
Avoid too many return
statements within this method. Open
return 'member' if member?
Avoid too many return
statements within this method. Open
return false