Showing 48 of 56 total issues
Method visual_checkout_step
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def visual_checkout_step step, active, checked, link = nil
step_title = I18n.t("cart.steps.#{step}")
content_tag :span, class: "visual_checkout_step #{active ? 'active' : ''}" do
concat(content_tag(:i, '', class: (checked ? 'fa fa-check-square-o' : 'fa fa-square-o')))
concat(' ')
- 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 show
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def show
set_content
authorize @content
if params && params[:layout] == 'false'
render 'clean_show', layout: false
- 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 attributes_for
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def attributes_for(user)
attributes = {
customer_type: user.is_a?(LegalEntity) ? 'business' : 'consumer',
organization: (user.is_a?(LegalEntity) &&
user.standard_address_company_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 title_image_url
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def title_image_url style = nil
if title_image_present?
if title_image.image.processing? && style != :thumb
title_image.original_image_url_while_processing
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 prepare_line_item_group_or_assign
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def prepare_line_item_group_or_assign cart, quantity
if self.new_record?
self.line_item_group = find_or_create_line_item_group cart
else
# we need to parse quantity to integer since it is a param and
- 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_tab
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_tab
if params[:tab] == 'payments' || (current_user == @line_item_group.buyer && !params[:tab])
@tab = :payments
elsif params[:tab] == 'transports' || (current_user == @line_item_group.seller && !params[:tab])
@tab = :transports
- 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 replace_image
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def replace_image should_be_title, attribute
old_image = self.images.select { |i| i.is_title == should_be_title }.first
return if old_image && old_image.external_url == self.send(attribute)
self.images.delete old_image if old_image # delete this image from the instance to not cause unique validation errors
image = load_new_image attribute, should_be_title
- 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 add_donation_organisations_to_donations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_donation_organisations_to_donations business_transactions
business_transactions.each do |bt|
if bt.article.friendly_percent_organisation_id && bt.article.friendly_percent_organisation_id != 0
organisation = User.find bt.article.friendly_percent_organisation_id
@donations[organisation] = [] unless @donations[organisation]
- 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
super
if cart = Cart.find_by_id(cookies.signed[:cart])
cart.update_attribute :user_id, current_user.id unless cart.user_id
- 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 pickup_time
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def pickup_time
times = []
day_of_week = DateTime.now.cwday - 1 # array starts with 0
weekend = day_of_week > 4 # is it Saturday or Sunday
day_of_week = 0 if weekend
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def find count = 2
return { library: nil, exhibits: [] } unless @library
exhibits = ordered_active_one_day_exhibited count
exhibits.each do |exhibit|
- 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 perform
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def perform cart_id
Cart.transaction do
cart = Cart.lock.find cart_id
# send email to buyer
- 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 business_transaction_fields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def business_transaction_fields(bt)
transport = bt.selected_transport
if (transport == 'type1')
transport = bt.article.transport_type1_provider
elsif (transport == 'type2')
- 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 concatenate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def concatenate
output = ''
prelast_index = count - 2
self.each_with_index do |element, index|
- 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 to_s
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_s
company_part = company_name.present? ? "#{company_name}, " : ''
title_part = title.present? ? "#{title} " : ''
address_line_2_part = address_line_2.present? ? "#{address_line_2}, " : ''
- 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 process
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process params
build_form_objects_from checkout ? session[:cart_checkout] : params
return :invalid unless valid?
if checkout
get_seller_specifics_from session
- 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 sanitize_tiny_mce
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.sanitize_tiny_mce field, admin_mode = false, remove_spaces = false
modify Sanitize.clean(
field,
elements: admin_mode ?
%w(a b i strong em p h1 h2 h3 h4 h5 h6 br hr ul ol li img div span iframe) :
- 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 index_title_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def index_title_for search_cache
attribute_list = ::HumanLanguageList.new
attribute_list << t('article.show.title.new') if search_cache.condition == 'new'
attribute_list << t('article.show.title.old') if search_cache.condition == 'old'
attribute_list << t('article.show.title.fair') if search_cache.fair
- 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 write_path_to_file_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def write_path_to_file_for(type)
if Rails.env == 'production'
arr = []
File.open("/var/www/fairnopoly/shared/backup_info/#{type}_#{Time.now.strftime('%Y_%m_%d')}", 'a') do |file|
self.image.styles.each_key do |style|
- 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 breadcrumbs_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def breadcrumbs_for category
output = ''
category.self_and_ancestors.each do |c|
last = c == category
output << '<span>'
- 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"