armandofox/audience1st

View on GitHub

Showing 127 of 387 total issues

Method check_purchaser_info has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def check_purchaser_info
    # walkup orders only need purchaser & recipient info to point to walkup
    #  customer, but regular orders need full purchaser & recipient info.
    if walkup?
      errors.add(:base, "Walkup order requires purchaser & recipient to be walkup customer") unless
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

Class Show has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

class Show < ActiveRecord::Base

  REGULAR_SHOW = 'Regular Show'
  TYPES = [REGULAR_SHOW, 'Special Event', 'Class', 'Subscription']

Severity: Minor
Found in app/models/show.rb - About 2 hrs to fix

    Method parse has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse
          unless valid?
            return @import.errors.add(:base, 'Import is invalid')
          end
          # A Goldstar will-call is always for exactly 1 performance
    Severity: Minor
    Found in app/services/ticket_sales_import_parser/goldstar.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 csv has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def csv
        csv = CSV.generate(:force_quotes => true) do |csv|
          csv << [
            'Payment Type',
            'Account Code #',
    Severity: Minor
    Found in app/services/reports/revenue_by_payment_method_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 add_tickets_without_capacity_checks has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def add_tickets_without_capacity_checks(valid_voucher, number, seats=[])
        raise Order::NotPersistedError unless persisted?
        new_vouchers = VoucherInstantiator.new(valid_voucher.vouchertype, :promo_code => valid_voucher.supplied_promo_code || valid_voucher.promo_code).from_vouchertype(number)
        # reserve only if a specific showdate is indicated.  it seems like this method
        # should really take a vouchertype and showdate.
    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 csv has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def csv
        csv = CSV.generate(:force_quotes => true) do |csv|
          csv << [
            'Payment Type',
            'Account Code #',
    Severity: Major
    Found in app/services/reports/revenue_by_payment_method_report.rb - About 2 hrs to fix

      Method confirm_multiple has a Cognitive Complexity of 15 (exceeds 5 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

      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 a Cognitive Complexity of 15 (exceeds 5 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

      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 47 lines of code (exceeds 25 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 1 hr to fix

        Method create has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def create
            @order = Order.create(
              :walkup => true,
              :customer => Customer.walkup_customer,
              :purchaser => Customer.walkup_customer,
        Severity: Minor
        Found in app/controllers/walkup_sales_controller.rb - About 1 hr to fix

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

            Method parse has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def parse
                  unless valid?
                    return @import.errors.add(:base, 'Import is invalid')
                  end
                  # A Goldstar will-call is always for exactly 1 performance
            Severity: Minor
            Found in app/services/ticket_sales_import_parser/goldstar.rb - About 1 hr to fix

              Method valid_row? has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  def valid_row?(row)
                    # all required (nonblank) columns are nonblank...
                    error("some required columns are blank") unless
                      REQUIRED_COLUMNS.all? { |col|  !(row[col].blank?) }
                    error("Order number is invalid") unless row["Order #"] =~ /\S+/
              Severity: Minor
              Found in app/services/ticket_sales_import_parser/today_tix.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 getSeatingOptionsForSubscriberReservation has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              A1.getSeatingOptionsForSubscriberReservation = function() {
                var container = $(this).closest('.form-row'); // the enclosing element that contains the relevant form fields
                var confirmButton = container.find('.confirm-seats');
                var specialSeating = container.find('.special-seating');
                var selectedSeats = container.find('.seat-display');
              Severity: Minor
              Found in app/assets/javascripts/seatmap_subscriber_reservation.js - About 1 hr to fix

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

                  Method update_email_subscription has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  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,
                  Severity: Minor
                  Found in app/models/customer.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 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def create
                      @order = Order.create(
                        :walkup => true,
                        :customer => Customer.walkup_customer,
                        :purchaser => Customer.walkup_customer,
                  Severity: Minor
                  Found in app/controllers/walkup_sales_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 at_beginning_of_season has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def at_beginning_of_season(oldyear = nil)
                          startmon = Option.season_start_month
                          startday = Option.season_start_day
                          if (oldyear)
                            # year given: just return start of that season
                  Severity: Minor
                  Found in lib/core_extensions/time/season.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 ready_for_purchase? has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def ready_for_purchase?
                      errors.clear
                      errors.add(:base, 'Shopping cart is empty') if cart_empty?
                      errors.add(:base, "You must specify the enrollee's name for classes") if
                        includes_enrollment? && comments.blank?
                  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 run_special has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  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])
                  Severity: Minor
                  Found in app/controllers/reports_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

                  Severity
                  Category
                  Status
                  Source
                  Language