armandofox/audience1st

View on GitHub

Showing 127 of 387 total issues

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

  def self.to_csv(custs,opts={})
    CSV::Writer.generate(output='') do |csv|
      unless opts[:suppress_header]
        header = self.csv_header
        header += opts[:extra].map(&:humanize) if opts[:extra]
Severity: Minor
Found in app/models/customer.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 save_and_update_foreign_keys! has a Cognitive Complexity of 8 (exceeds 5 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 45 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 check_box_toggle has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def check_box_toggle(name, checked, elt, ifchecked, ifnotchecked, opts={})
Severity: Minor
Found in app/helpers/application_helper.rb - About 45 mins to fix

    Function hide_checkbox has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    A1.hide_checkbox = function() {
      var elt = $(this);
      var selector = elt.data('selector');
      var action_if_checked = elt.data('ifchecked');
      if (elt.is(':checked')) {
    Severity: Minor
    Found in app/assets/javascripts/hide_checkbox.js - About 45 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 get_showdate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_showdate
        if (@showdate = Showdate.in_theater.find_by(:id => params[:id]))
          @showdates = Showdate.in_theater.all_showdates_for_seasons(Time.current.year, Time.current.year+1)
          @showdates << @showdate unless @showdates.include?(@showdate)
          @page_title = "Will call: #{@showdate.thedate.to_formatted_s(:foh)}"
    Severity: Minor
    Found in app/controllers/checkins_controller.rb - About 45 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 run has a Cognitive Complexity of 8 (exceeds 5 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 45 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 ticket_rss has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def ticket_rss
        now = Time.current
        # end_date = now.next_year.at_beginning_of_year
        end_date = now + 3.months
        showdates =
    Severity: Minor
    Found in app/controllers/info_controller.rb - About 45 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_from_secret has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def create_from_secret
        create_session do |params|
          permitted = secret_question_params
          @email = params[:email]
          u = Customer.authenticate_from_secret_question(@email, permitted, params[:answer])
    Severity: Minor
    Found in app/controllers/sessions_controller.rb - About 45 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 force_valid_fields has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def force_valid_fields
        if self.force_valid
          self.created_by_admin = true # will skip most validations
          self.first_name = '_' if first_name.blank?
          self.first_name.gsub!(NAME_FORBIDDEN_CHARS, '_')
    Severity: Minor
    Found in app/models/customer.rb - About 45 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 update has a Cognitive Complexity of 8 (exceeds 5 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 45 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 time_in_words_relative_to has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def time_in_words_relative_to(ed,sd)
        seconds_between = (ed - sd).abs
        if seconds_between < 1.hour
          "#{(seconds_between / 60).to_i} minutes %s performance starts" % ( ed > sd ? 'after' : 'before' )
        elsif (sd.month == ed.month) && (sd.day == ed.day) && (sd.year == ed.year)
    Severity: Minor
    Found in app/helpers/showdates_helper.rb - About 45 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 to_csv has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def to_csv
        [
          (first_name.name_capitalize unless first_name.blank?),
          (last_name.name_capitalize unless last_name.blank?),
          id,
    Severity: Minor
    Found in app/models/customer.rb - About 45 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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def initialize(showdate_as_date, _price, _noffered, _nsold,
                     name_str="%goldstar%")
    Severity: Minor
    Found in app/models/ticket_offer.rb - About 35 mins to fix

      Function startTimer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      A1.startTimer = function(timerExpirationField, timerDisplayField, expiredCallback) {
        var timerExpiresAt;
        var handler;
        
        if (timerExpirationField.length < 1) { return; } // field not present = order is done
      Severity: Minor
      Found in app/assets/javascripts/timer.js - About 35 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 from_param has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def from_param(param,default=::Time.current)
                return default if param.blank?
                return ::Time.zone.parse(param) unless param.kind_of?(Hash)
                t = ::Time.local(0,1,1,0,0,0)
                [:year,:month,:day,:hour].each do |component|
      Severity: Minor
      Found in lib/core_extensions/time/to_param.rb - About 35 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 dates has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def dates
          return @dates unless @dates.empty?
          # Special case: if only a single date is selected, ignore the 'which days'
          # boxes and just return a list consisting of this date.
          if (@start_date == @end_date)
      Severity: Minor
      Found in lib/datetime_range.rb - About 35 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 seats_of_type_remaining has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def seats_of_type_remaining
          unless showdate
            self.explanation = "No limit"
            return INFINITE
          end
      Severity: Minor
      Found in app/models/valid_voucher.rb - About 35 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 display_min_and_max_sales_per_txn has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def display_min_and_max_sales_per_txn
          if min_sales_per_txn == 1
            max_sales_per_txn == INFINITE ? '' : "(max #{max_sales_per_txn} per order)"
          else                        # minimum order
            case max_sales_per_txn
      Severity: Minor
      Found in app/models/valid_voucher.rb - About 35 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 resolve_customer_in_url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def resolve_customer_in_url(logged_in_user, desired)
          if !logged_in_user
            Customer.anonymous_customer
          elsif  logged_in_user.is_boxoffice
            # someone is logged in. if staff, correct redirect is to the specified user, UNLESS
      Severity: Minor
      Found in app/controllers/store_controller.rb - About 35 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

      Avoid too many return statements within this method.
      Open

            redirect_to_last_list and return
      Severity: Major
      Found in app/controllers/customers_controller.rb - About 30 mins to fix
        Severity
        Category
        Status
        Source
        Language