armandofox/audience1st

View on GitHub

Showing 127 of 387 total issues

Method create has 29 lines of code (exceeds 25 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

    Method check_sales_limits has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def check_sales_limits
        showdates = Hash.new { 0 }
        num_of_type = Hash.new { 0 }
        imported_orders.reject(&:completed?).each do |i|
          i.vouchers.each do |voucher|
    Severity: Minor
    Found in app/models/ticket_sales_import.rb - About 1 hr to fix

      Function click has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ,click: function(evt) {
            var clickedSeat = this.settings.id; // format:  ZoneName-A111 (hyphen is separator)
            var seatNum = A1.seatmap.seatLabelToSeatNum(clickedSeat);
            switch(this.status()) {
            case 'available':           // clicking on available seat selects it...
      Severity: Minor
      Found in app/assets/javascripts/seatmap.js - About 1 hr to fix

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

          def update
            # :rails5: this can be simplified since Rails 5.1+ allows :included_vouchers => {} to
            #  pass through ANY keys in that hash
            included_voucher_keys = params[:vouchertype][:included_vouchers] ? params[:vouchertype][:included_vouchers].keys : []
            vouchertype_update_params =
        Severity: Minor
        Found in app/controllers/vouchertypes_controller.rb - About 1 hr to fix

          Method initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def initialize(showdate_as_date, _price, _noffered, _nsold,
                           name_str="%goldstar%")
              @price,@noffered,@nsold = _price,_noffered.to_i,_nsold.to_i
              raise(ArgumentError, "Number offered and sold must be >= 0") unless
                (@noffered >= 0 && @nsold >= 0)
          Severity: Minor
          Found in app/models/ticket_offer.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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              creation_params =
                params.require(:vouchertype).
                  permit(:category, :name, :price, :seating_zone_id, :seating_zone, :offer_public, :season, :display_order, :fulfillment_needed, :walkup_sale_allowed, :changeable, :subscription, :comments, :account_code_id)
              @vouchertype = Vouchertype.new(creation_params)
          Severity: Minor
          Found in app/controllers/vouchertypes_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 a Cognitive Complexity of 10 (exceeds 5 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

          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 click has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              ,click: function(evt) {
                var clickedSeat = this.settings.id; // format:  ZoneName-A111 (hyphen is separator)
                var seatNum = A1.seatmap.seatLabelToSeatNum(clickedSeat);
                switch(this.status()) {
                case 'available':           // clicking on available seat selects it...
          Severity: Minor
          Found in app/assets/javascripts/seatmap.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 update has a Cognitive Complexity of 10 (exceeds 5 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

          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 inspect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def inspect
              if vouchertype_id.nil?
                sprintf("%d (No vouchertype)", (new_record? ? object_id : id))
              else
                s = sprintf("%d %s", (new_record? ? object_id : id), vouchertype.name)
          Severity: Minor
          Found in app/models/items/voucher.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 <=> has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          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
          Severity: Minor
          Found in app/services/voucher_presenter.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 run has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def run
              items =
                Item.
                joins(:order).
                includes(:order,:account_code,:customer,:vouchertype, :showdate => :show).
          Severity: Minor
          Found in app/services/reports/revenue_by_payment_method_report.rb - About 1 hr to fix

            Method add_data_rows has 26 lines of code (exceeds 25 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

              Consider simplifying this complex logical expression.
              Open

                  if (first_name.blank? || last_name.blank? || email.blank? || street.blank? || city.blank? || state.blank? || zip.blank?)
                    errors.add :base, "Please provide your email address for order confirmation, and your credit card billing name and address."
                    false
                  else
                    # this is a HACK: set created_by_admin to bypass most other validations.
              Severity: Major
              Found in app/models/customer.rb - About 1 hr to fix

                Method one_line_description has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def one_line_description(opts={})
                    s = opts[:suppress_price] ? '' : sprintf("$%6.2f  ", amount)
                    if reserved?
                      s << sprintf("%s\n         %s", showdate.printable_name, name)
                      s << " #{seat}" unless opts[:suppress_seat]
                Severity: Minor
                Found in app/models/items/voucher.rb - About 55 mins 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_session has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def create_session(u = nil, action = '')
                    logout_keeping_session!
                    @user = u || yield(params)
                    if @user && @user.errors.empty?
                      # Protects against session fixation attacks, causes request forgery
                Severity: Minor
                Found in app/controllers/application_controller.rb - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def generate(params = {})
                    shows = Report.list_of_ints_from_multiselect(params[:shows])
                    # do default search for OR. if it's AND, winnow the list afterward.
                    shows_not = Report.list_of_ints_from_multiselect(params[:shows_not])
                    vouchertypes = Report.list_of_ints_from_multiselect(params[:vouchertypes])
                Severity: Minor
                Found in app/models/reports/attendance_by_show.rb - About 55 mins 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 mark_fulfilled has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def mark_fulfilled
                    i = 0
                    flash[:notice] = ''
                    params[:voucher].each_pair do |vid,do_update|
                      next if do_update.to_i.zero?
                Severity: Minor
                Found in app/controllers/reports_controller.rb - About 55 mins 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 revenue_by_payment_method has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def revenue_by_payment_method
                    # report may be by date range or by production
                    case params[:txn_report_by]
                    when 'date'
                      from,to = Time.range_from_params(params[:txn_report_dates])
                Severity: Minor
                Found in app/controllers/reports_controller.rb - About 55 mins 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 purchasemethod_from_params has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def purchasemethod_from_params
                    # for a regular customer, the only options are 'credit' or 'none' (the latter only valid
                    #  if a zero-price order)
                
                    # if Stripe successfully registered a CC purchase, 'fake' the :commit parameter (Submit
                Severity: Minor
                Found in app/controllers/store_controller.rb - About 55 mins 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