Showing 76 of 91 total issues
Method after_update
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def after_update(item)
original = @@tasks.delete(item.id)
if original
return log_activity(item, :complete) if item.completed_at && original.completed_at.nil?
return log_activity(item, :reassign) if item.assigned_to != original.assigned_to
- 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 initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(user)
# handle signup
can(:create, User) if User.can_signup?
if user.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 visible_to
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def visible_to(user)
all.to_a.delete_if do |version|
if item = version.item || version.reify
if item.respond_to?(:access) # NOTE: Tasks don't have :access as of yet.
# Delete from scope if it shouldn't be visible
- 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 render_value
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def render_value(object)
return "" unless paired_with.present?
from = render(object.send(name))
to = render(object.send(paired_with.name))
- 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 auto_complete
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def auto_complete
@query = params[:term] || ''
@auto_complete = hook(:auto_complete, self, query: @query, user: current_user)
if @auto_complete.empty?
exclude_ids = auto_complete_ids_to_exclude(params[:related])
- 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 col
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def col(title, value = nil, last = false, email = false, &_block)
last_class = (last ? 'last' : nil)
out = content_tag(:th, title, class: last_class)
if block_given?
out << content_tag(:td, class: last_class) do
- 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 respond_to_destroy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def respond_to_destroy(method)
if method == :ajax
get_data_for_sidebar
@campaigns = get_campaigns
if @campaigns.blank?
- 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 user_summary
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def user_summary(user)
summary = []
title_and_company = user_summary_title_and_company(user)
summary << title_and_company unless title_and_company.blank?
summary << t('pluralize.login', user.sign_in_count) if user.last_sign_in_at && user.sign_in_count.positive?
- 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_or_select_for
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.create_or_select_for(model, params)
# Attempt to find existing account
return Account.find(params[:id]) if params[:id].present?
if params[:name].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 computed_bucket
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def computed_bucket
return bucket if bucket != "specific_time"
if overdue?
"overdue"
- 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 respond_to_destroy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def respond_to_destroy(method)
if method == :ajax
@accounts = get_accounts
get_data_for_sidebar
if @accounts.empty?
- 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 col
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def col(title, value = nil, last = false, email = false, &_block)
Method web_presence_icons
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def web_presence_icons(person)
%i[blog linkedin facebook twitter skype].map do |site|
url = person.send(site)
next if url.blank?
- 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 redraw
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def redraw
current_user.pref[:leads_per_page] = per_page_param if per_page_param
# Sorting and naming only: set the same option for Contacts if the hasn't been set yet.
if params[:sort_by]
- 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 from_array
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.from_array(items = [])
return '' if items.empty?
# Infer column types from the first item in the array
klass = items.first.class
- 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 account_with_title_and_department
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def account_with_title_and_department(contact)
text = if !contact.title.blank? && contact.account
# works_at: "{{h(job_title)}} at {{h(company)}}"
content_tag :div, t(:works_at, job_title: h(contact.title), company: h(account_with_url_for(contact))).html_safe
elsif !contact.title.blank?
- 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 disconnect!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def disconnect!
if @imap
@imap.logout
unless @imap.disconnected?
begin
- 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 redraw
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def redraw
current_user.pref[:contacts_per_page] = per_page_param if per_page_param
# Sorting and naming only: set the same option for Leads if the hasn't been set yet.
if params[:sort_by]
- 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 save_with_account_and_permissions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def save_with_account_and_permissions(params)
# Quick sanitization, makes sure Account will not search for blank id.
params[:account].delete(:id) if params[:account][:id].blank?
account = Account.create_or_select_for(self, params[:account])
self.account_opportunity = AccountOpportunity.new(account: account, opportunity: self) unless account.id.blank?
- 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 brief_account_info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def brief_account_info(contact)
text = ""
title = contact.title
department = contact.department
account = contact.account
- 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"