Showing 387 of 387 total issues
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 has too many lines. [42/30] Open
def generate
@csv = CSV.generate do |csv|
csv << [
'Show Name',
'Run Dates',
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Cyclomatic complexity for index is too high. [17/6] Open
def index
@total = 0
@params = {}
@page_title = "Donation history"
@page = (params[:page] || '1').to_i
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
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)
Cyclomatic complexity for merge is too high. [15/6] 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
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for update_email_subscription is too high. [14/6] 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
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for update is too high. [14/6] Open
def update
@order = Order.find params[:id]
items = Item.find(params[:items].keys) rescue []
if items.empty?
redirect_to(order_path(@order), :alert => 'No items selected for refund.') and return
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for postprocess is too high. [13/6] 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
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Method has too many lines. [37/30] Open
def update
@order = Order.find params[:id]
items = Item.find(params[:items].keys) rescue []
if items.empty?
redirect_to(order_path(@order), :alert => 'No items selected for refund.') and return
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Cyclomatic complexity for <=> is too high. [13/6] Open
def <=>(other)
sd1,vt1 = self.showdate, self.vouchertype
sd2,vt2 = other.showdate, other.vouchertype
if vt1 == vt2
# same vouchertype: order by OPENING DATE of the show for which reserved, or display order
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for run_special is too high. [13/6] 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
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
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"