Showing 127 of 387 total issues
Method check_purchaser_info
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def check_purchaser_info
# walkup orders only need purchaser & recipient info to point to walkup
# customer, but regular orders need full purchaser & recipient info.
if walkup?
errors.add(:base, "Walkup order requires purchaser & recipient to be walkup customer") 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
Class Show
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Show < ActiveRecord::Base
REGULAR_SHOW = 'Regular Show'
TYPES = [REGULAR_SHOW, 'Special Event', 'Class', 'Subscription']
Method parse
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def parse
unless valid?
return @import.errors.add(:base, 'Import is invalid')
end
# A Goldstar will-call is always for exactly 1 performance
- 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 csv
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def csv
csv = CSV.generate(:force_quotes => true) do |csv|
csv << [
'Payment Type',
'Account Code #',
- 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_tickets_without_capacity_checks
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def add_tickets_without_capacity_checks(valid_voucher, number, seats=[])
raise Order::NotPersistedError unless persisted?
new_vouchers = VoucherInstantiator.new(valid_voucher.vouchertype, :promo_code => valid_voucher.supplied_promo_code || valid_voucher.promo_code).from_vouchertype(number)
# reserve only if a specific showdate is indicated. it seems like this method
# should really take a vouchertype and showdate.
- 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 csv
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def csv
csv = CSV.generate(:force_quotes => true) do |csv|
csv << [
'Payment Type',
'Account Code #',
Method confirm_multiple
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def confirm_multiple
@params = params.permit(:number, :showdate_id, :customer_id, :seats, :comments, :voucher_ids, :zone)
the_showdate = Showdate.find_by(:id => params[:showdate_id])
num = @params[:number].to_i
return redirect_to(customer_path(@customer), :alert => t("#{ERR}no_showdate")) unless the_showdate
- 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 finalize!
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def finalize!(sold_on_date = Time.current)
raise Order::NotReadyError unless ready_for_purchase?
# for credit card orders ONLY:
# mark order as Pending, run the card and rescue any errors, then finalize order.
auth = nil
- 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 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
@total = 0
@params = {}
@page_title = "Donation history"
@page = (params[:page] || '1').to_i
Method create
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@order = Order.create(
:walkup => true,
:customer => Customer.walkup_customer,
:purchaser => Customer.walkup_customer,
Method run_special
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_special
return unless (klass = validate_report_type params[:report_name])
action = params[:what]
full_report_url = request.fullpath
@report = klass.__send__(:new, params[:output])
Method parse
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse
unless valid?
return @import.errors.add(:base, 'Import is invalid')
end
# A Goldstar will-call is always for exactly 1 performance
Method valid_row?
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def valid_row?(row)
# all required (nonblank) columns are nonblank...
error("some required columns are blank") unless
REQUIRED_COLUMNS.all? { |col| !(row[col].blank?) }
error("Order number is invalid") unless row["Order #"] =~ /\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
Function getSeatingOptionsForSubscriberReservation
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
A1.getSeatingOptionsForSubscriberReservation = function() {
var container = $(this).closest('.form-row'); // the enclosing element that contains the relevant form fields
var confirmButton = container.find('.confirm-seats');
var specialSeating = container.find('.special-seating');
var selectedSeats = container.find('.seat-display');
Method generate
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate
@csv = CSV.generate do |csv|
csv << [
'Show Name',
'Run Dates',
Method update_email_subscription
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def update_email_subscription
return unless (e_blacklist_changed? || email_changed? || first_name_changed? || last_name_changed?)
email_list = EmailList.new or return
if e_blacklist # opting out of email
# do nothing, EXCEPT in the case where customer is transitioning from opt-in to opt-out,
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def create
@order = Order.create(
:walkup => true,
:customer => Customer.walkup_customer,
:purchaser => Customer.walkup_customer,
- 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 at_beginning_of_season
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def at_beginning_of_season(oldyear = nil)
startmon = Option.season_start_month
startday = Option.season_start_day
if (oldyear)
# year given: just return start of that season
- 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 ready_for_purchase?
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def ready_for_purchase?
errors.clear
errors.add(:base, 'Shopping cart is empty') if cart_empty?
errors.add(:base, "You must specify the enrollee's name for classes") if
includes_enrollment? && comments.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 run_special
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def run_special
return unless (klass = validate_report_type params[:report_name])
action = params[:what]
full_report_url = request.fullpath
@report = klass.__send__(:new, params[:output])
- 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"