armandofox/audience1st

View on GitHub

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
Severity: Major
Found in app/models/order.rb - About 7 hrs to fix

    Class Voucher has 49 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Voucher < Item
      belongs_to :showdate
    
      class ReservationError < StandardError ;  end
    
    
    Severity: Minor
    Found in app/models/items/voucher.rb - About 6 hrs to fix

      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'
      Severity: Minor
      Found in app/models/customer.rb - About 6 hrs to fix

        Class Vouchertype has 42 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Vouchertype < ActiveRecord::Base
          
          belongs_to :account_code
          validates_associated :account_code
        
        
        Severity: Minor
        Found in app/models/vouchertype.rb - About 5 hrs to fix

          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
          Severity: Minor
          Found in app/models/order.rb - About 5 hrs to fix

            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
            Severity: Minor
            Found in app/controllers/customers_controller.rb - About 4 hrs to fix

              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
                
              Severity: Minor
              Found in app/models/valid_voucher.rb - About 4 hrs to fix

                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'
                Severity: Minor
                Found in app/models/customer.rb - About 4 hrs to fix

                  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|
                  Severity: Minor
                  Found in app/models/seatmap/parser.rb - About 3 hrs to fix

                  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
                  Severity: Minor
                  Found in app/models/showdate.rb - About 3 hrs to fix

                    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)
                    Severity: Minor
                    Found in app/controllers/customers_controller.rb - About 3 hrs to fix

                      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
                      Severity: Minor
                      Found in app/models/order.rb - About 2 hrs to fix

                      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
                      Severity: Minor
                      Found in app/controllers/donations_controller.rb - About 2 hrs to fix

                      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');
                      Severity: Major
                      Found in app/assets/javascripts/seatmap_import.js - About 2 hrs to fix

                        File voucher.rb has 286 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        class Voucher < Item
                          belongs_to :showdate
                        
                          class ReservationError < StandardError ;  end
                        
                        
                        Severity: Minor
                        Found in app/models/items/voucher.rb - About 2 hrs to fix

                          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
                          Severity: Major
                          Found in app/helpers/dates_helper.rb - About 2 hrs to fix

                            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)
                            Severity: Minor
                            Found in app/controllers/store_controller.rb - About 2 hrs to fix

                              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
                                
                              Severity: Minor
                              Found in app/models/valid_voucher.rb - About 2 hrs to fix

                                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|
                                Severity: Minor
                                Found in app/models/report.rb - About 2 hrs to fix

                                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',
                                Severity: Minor
                                Found in app/services/reports/show_advance_sales_report.rb - About 2 hrs to fix

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language