Showing 127 of 387 total issues
Avoid too many return
statements within this method. Open
redirect_to(order_path(@order), :alert => "Error destroying order: #{e}") and return
Avoid too many return
statements within this method. Open
return self.gsub(/^(\w)|-(\w)/) { |a| a.upcase }
Avoid too many return
statements within this method. Open
redirect_to_last_list and return
Method authenticate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.authenticate(email, password)
if (email.blank? || password.blank?)
u = Customer.new
u.errors.add(:login_failed, I18n.t('login.email_or_password_blank'))
return u
- 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 walkup_subscriber_confirm
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def walkup_subscriber_confirm
return redirect_to(checkin_path(@showdate), :alert => "No vouchers were selected for check-in.") unless (@vouchers = params[:vouchers].try(:keys))
begin
Voucher.find(@vouchers).each do |v|
v.reserve_for(@showdate, current_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 add_retail_items_to_cart
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_retail_items_to_cart
return unless @gAdminDisplay && params[:retail].to_f > 0.0
@gOrderInProgress.errors.add(:base, "Retail items can't be included in a gift order") and return if
params[:gift]
r = RetailItem.from_amount_description_and_account_code_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 can_be_changed?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def can_be_changed?(who = Customer.walkup_customer)
unless who.kind_of?(Customer)
who = Customer.find(who) rescue Customer.walkup_customer
end
return (who.is_walkup) ||
- 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 not_previously_imported?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def not_previously_imported?
# just in case, don't preload all imports!
(TicketSalesImport.all - [self]).each do |i|
if self.raw_data.strip == i.raw_data.strip
msg = i.completed? ?
- 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 select_date_with_shortcuts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def select_date_with_shortcuts(name, options={})
t = Time.current
t8601 = t.iso8601
start_date = (options[:from] || 1.day.ago).at_beginning_of_day
end_date = (options[:to] || t).at_beginning_of_day
- 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 checkout
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def checkout
# only show timer if cart has any vouchers for specific dates
@page_title = "Review Order For #{@customer.full_name}"
@sales_final_acknowledged = @gAdminDisplay || (params[:sales_final].to_i > 0)
@checkout_message = (@gOrderInProgress.includes_reserved_vouchers? ? Option.precheckout_popup : '')
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def index
@superadmin = current_user.is_admin
@season = (params[:season].to_i > 1900 ? params[:season].to_i : Time.this_season)
year = Time.current.year
@earliest = Show.minimum(:season) || year
- 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 merge
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def merge
if !params[:merge] || params[:merge].keys.length < 1
flash[:alert] = 'You have not selected any customers.'
redirect_to_last_list and return
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 owns_voucher_or_is_boxoffice
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def owns_voucher_or_is_boxoffice
@voucher = Voucher.find(params[:id]) if params[:id]
@customer = Customer.find params[:customer_id]
return if current_user.is_boxoffice
redirect_to(customer_path(current_user), :alert => t("#{ERR}not_your_voucher")) unless
- 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 menu_label_function
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def menu_label_function(admin_display = false)
if admin_display
single_production ? :date_with_explanation_for_admin : :name_with_explanation_for_admin
else
single_production ? :date_with_explanation : :name_with_explanation
- 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 check_sales_limits
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_sales_limits
showdates = Hash.new { 0 }
num_of_type = Hash.new { 0 }
imported_orders.reject(&:completed?).each do |i|
i.vouchers.each do |voucher|
- 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 role_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.role_name(rval)
r = rval.to_i
if r > 30 then 'admin'
elsif r >= 30 then 'boxoffice_manager'
elsif r >= 20 then 'boxoffice'
- 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 seatmap_and_unavailable_seats_as_json
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.seatmap_and_unavailable_seats_as_json(showdate, restrict_to_zone: nil, selected: [], is_boxoffice: false)
return Seatmap::AsJson.empty unless (sm = showdate.seatmap)
map = Seatmap::AsJson.new(sm)
map.selected = selected
map.holdback = showdate.house_seats.sort
- 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
return redirect_to(ticket_sales_imports_path, :alert => 'Please choose a will-call list to upload.') if params[:file].blank?
@import = TicketSalesImport.new(ticketsalesimport_params)
@import.processed_by = current_user
return redirect_to(ticket_sales_imports_path(:vendor => @import.vendor), :alert => @import.errors.as_html) unless @import.valid?
- 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 assign_seats
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def assign_seats
# XHR call with params['seats'] = JSON array of selected seats, params['vouchers'] =
# comma-separated IDs of vouchers
vouchers = Voucher.find(params[:vouchers].split(/\s*,\s*/))
seats = params[:seats].split(/\s*,\s*/)
- 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_date_list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.from_date_list(dates, sales_cutoff, params)
# force boolean values to be false if fields are blank
params[:stream_anytime] = false if params[:stream_anytime].blank?
params[:live_stream] = false if params[:live_stream].blank?
if params[:live_stream] || params[:stream_anytime]
- 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"