armandofox/audience1st

View on GitHub

Showing 127 of 387 total issues

Method update has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    # Transactionally add one or more vouchertypes to multiple showdates.  
    # If errors, collate them intelligently and fail.
    # If +valid_voucher_params+ includes a key
    # <tt>:before_showtime => val</tt>, then each valid voucher's end-sales should be overridden to be
Severity: Minor
Found in app/services/redemption_batch_updater.rb - About 1 hr 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 finalize! has 37 lines of code (exceeds 25 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
Severity: Minor
Found in app/models/order.rb - About 1 hr to fix

    Method update has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    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
    Severity: Minor
    Found in app/controllers/orders_controller.rb - About 1 hr to fix

      Function getSeatingOptionsForAddComps has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      A1.getSeatingOptionsForAddComps = function() {
        // triggered when a new perf is selected during Add Comps flow
        var showdateID = $('#comp_order_showdate_id').val();
        var resetAfter = function() {
          $('#seating-charts-wrapper').addClass('d-none');
      Severity: Minor
      Found in app/assets/javascripts/seatmap_add_comps.js - About 1 hr to fix

        Method update has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def update
            # editing contact info may be called from various places. correctly
            # set the return-to so that form buttons can do the right thing.
            # unless admin, remove "extra contact" fields
            if @gAdminDisplay
        Severity: Minor
        Found in app/controllers/customers_controller.rb - About 1 hr to fix

          Method create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              warnings = []
              cutoff = params[:advance_sales_cutoff].to_i.minutes
              # determine date list from EITHER the date range, or for stream-anytime, single date
              if params[:showdate][:stream_anytime].blank?
          Severity: Minor
          Found in app/controllers/showdates_controller.rb - About 1 hr 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 shipping_address has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def shipping_address
              @mailable = @gOrderInProgress.includes_mailable_items?
              @recipient = Customer.new and return if request.get?
              # request is a POST: collect shipping address
              # record whether we should mail to purchaser or recipient
          Severity: Minor
          Found in app/controllers/store_controller.rb - About 1 hr to fix

            Method postprocess has 32 lines of code (exceeds 25 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 1 hr to fix

              Function recalcWalkupSales has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              A1.recalcWalkupSales = function() {
                var total = A1.recalculate('#total', '.item', 2, 'price');
                var numTickets = A1.orderState.ticketCount;
                A1.recalculate('#totaltix', '.itemCount', 0);
                if (A1.seatmapWalkupSales.seatmapInfo == '') {
              Severity: Minor
              Found in app/assets/javascripts/walkup_sales.js - About 1 hr 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 check has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def check(allowed_content_types: [])
                  unless @uri_str =~ /^https?:\/\//i
                    @errors.add(:base, 'URI must begin with http:// or https://')
                    return false
                  end
              Severity: Minor
              Found in lib/simple_uri_checker.rb - About 1 hr 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 place_order has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def place_order
                  @page_title = "Confirmation of Order #{@gOrderInProgress.id}"
                  # what payment type?
                  @gOrderInProgress.purchasemethod,@gOrderInProgress.purchase_args = purchasemethod_from_params
                  @recipient = @gOrderInProgress.customer
              Severity: Minor
              Found in app/controllers/store_controller.rb - About 1 hr 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 update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def update
                  # editing contact info may be called from various places. correctly
                  # set the return-to so that form buttons can do the right thing.
                  # unless admin, remove "extra contact" fields
                  if @gAdminDisplay
              Severity: Minor
              Found in app/controllers/customers_controller.rb - About 1 hr 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 add_data_rows has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def add_data_rows(csv)
                  # grab the IDs of the whole set, then find in batches to avoid instantiating lots of objects
                  order = self.output_options[:sort_by_zip] == '1' ?
                            "customers.zip, customers.last_name" :
                            "customers.last_name, customers.zip"
              Severity: Minor
              Found in app/models/report.rb - About 1 hr 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 walkup_confirmation_notice has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def walkup_confirmation_notice
                  notice = []
                  notice << "#{'$%.02f' % donation.amount} donation" if includes_donation?
                  if includes_vouchers?
                    notice << "#{ticket_count} ticket" + (ticket_count > 1 ? 's' : '')
              Severity: Minor
              Found in app/models/order.rb - About 1 hr 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 create has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def create
                  @order = Order.create(:purchaser => @customer, :customer => @customer, :processed_by => current_user)
                  @donation = Donation.from_amount_and_account_code_id(
                    params[:amount].to_f, params[:fund].to_i, params[:comments].to_s)
                  @order.add_donation(@donation)
              Severity: Minor
              Found in app/controllers/donations_controller.rb - About 1 hr to fix

                Method merge has 31 lines of code (exceeds 25 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
                Severity: Minor
                Found in app/controllers/customers_controller.rb - About 1 hr to fix

                  Function adjustShowdateType has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  A1.adjustShowdateType = function() {
                    var perfType = $(this).val();
                    var maxSalesDefault;
                    function saveMaxSalesDefault() { $('#saved_max_sales').val($('#max_advance_sales').val()); }
                    function restoreMaxSalesDefault() { $('#max_advance_sales').val($('#saved_max_sales').val()); }
                  Severity: Minor
                  Found in app/assets/javascripts/showdate.js - About 1 hr to fix

                    Method save_and_update_foreign_keys! has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def self.save_and_update_foreign_keys!(c0,c1)
                        new = c0.id
                        old = c1.id
                        ok = nil
                        msg = []
                    Severity: Minor
                    Found in app/models/customer/merge.rb - About 1 hr to fix

                      Method confirm_multiple has 30 lines of code (exceeds 25 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
                      Severity: Minor
                      Found in app/controllers/vouchers_controller.rb - About 1 hr to fix

                        Method finalize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def finalize(customer_for)
                            begin
                              ActiveRecord::Base.transaction do
                                self.imported_orders.each do |order|
                                  order.processed_by = self.processed_by
                        Severity: Minor
                        Found in app/models/ticket_sales_import.rb - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language