Showing 127 of 387 total issues
Class Order
has 54 methods (exceeds 20 allowed). Consider refactoring. Open
class Order < ActiveRecord::Base
belongs_to :customer
belongs_to :purchaser, :class_name => 'Customer'
belongs_to :processed_by, :class_name => 'Customer'
has_many :items, :autosave => true, :dependent => :destroy
Class Voucher
has 49 methods (exceeds 20 allowed). Consider refactoring. Open
class Voucher < Item
belongs_to :showdate
class ReservationError < StandardError ; end
Class Customer
has 47 methods (exceeds 20 allowed). Consider refactoring. Open
class Customer < ActiveRecord::Base
require_dependency 'customer/roles'
require_dependency 'customer/search'
require_dependency 'customer/special_customers'
Class Vouchertype
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
class Vouchertype < ActiveRecord::Base
belongs_to :account_code
validates_associated :account_code
File order.rb
has 375 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Order < ActiveRecord::Base
belongs_to :customer
belongs_to :purchaser, :class_name => 'Customer'
belongs_to :processed_by, :class_name => 'Customer'
has_many :items, :autosave => true, :dependent => :destroy
File customers_controller.rb
has 360 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'will_paginate/array'
class CustomersController < ApplicationController
# Actions requiring no login, customer login, and staff login respectively
Class ValidVoucher
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class ValidVoucher < ActiveRecord::Base
# Capacity is infinite if it is left blank
INFINITE = 100_000
File customer.rb
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Customer < ActiveRecord::Base
require_dependency 'customer/roles'
require_dependency 'customer/search'
require_dependency 'customer/special_customers'
Method parse_rows
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def parse_rows
@as_js = []
@seat_rows.each do |row|
row_string = ''
row.each do |cell|
- 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 Showdate
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Showdate < ActiveRecord::Base
include Comparable
belongs_to :show
Class CustomersController
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class CustomersController < ApplicationController
# Actions requiring no login, customer login, and staff login respectively
ACTIONS_WITHOUT_LOGIN = %w(new user_create forgot_password guest_checkout guest_checkout_create reset_token)
CUSTOMER_ACTIONS = %w(show edit update change_password_for change_secret_question)
Method add_tickets_from_params
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def add_tickets_from_params(valid_voucher_params, customer, promo_code: '', seats: [])
return unless valid_voucher_params
seats2 = seats.dup
total_tickets = valid_voucher_params.map do |id,count|
ValidVoucher.find(id).vouchertype.reservable? ? count.to_i : 0
- 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 21 (exceeds 5 allowed). Consider refactoring. Open
def index
@total = 0
@params = {}
@page_title = "Donation history"
@page = (params[:page] || '1').to_i
- 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 showMap
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
showMap: function(evt) {
var choose = $(this);
var container = choose.closest('.import-row');
var showdateID = container.find('.showdate-id').val();
var selectedSeats = container.find('.seat-display');
File voucher.rb
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Voucher < Item
belongs_to :showdate
class ReservationError < StandardError ; end
Method select_date_with_shortcuts
has 71 lines of code (exceeds 25 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
File store_controller.rb
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
class StoreController < ApplicationController
include StoreHelper
skip_before_filter :verify_authenticity_token, :only => %w(show_changed showdate_changed)
File valid_voucher.rb
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ValidVoucher < ActiveRecord::Base
# Capacity is infinite if it is left blank
INFINITE = 100_000
Method postprocess
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def postprocess
# things we can do on the relation
# we always seem to need Labels to include as part of result
@relation = @relation.includes(:labels)
@output_options.each_pair do |option,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 generate
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def generate
@csv = CSV.generate do |csv|
csv << [
'Show Name',
'Run Dates',
- 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"