armandofox/audience1st

View on GitHub

Showing 127 of 387 total issues

Method seatmap_and_unavailable_seats_as_json has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.seatmap_and_unavailable_seats_as_json(showdate, restrict_to_zone: nil, selected: [], is_boxoffice: false)
    return Seatmap::AsJson.empty unless (sm = showdate.seatmap)
    map = Seatmap::AsJson.new(sm)
    map.selected = selected
    map.holdback = showdate.house_seats.sort
Severity: Minor
Found in app/models/seatmap.rb - About 25 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 role_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.role_name(rval)
    r = rval.to_i
    if r > 30 then 'admin'
    elsif r >= 30 then 'boxoffice_manager'
    elsif r >= 20 then 'boxoffice'
Severity: Minor
Found in app/models/customer/roles.rb - About 25 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 checkout has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def checkout
    # only show timer if cart has any vouchers for specific dates
    @page_title = "Review Order For #{@customer.full_name}"
    @sales_final_acknowledged = @gAdminDisplay || (params[:sales_final].to_i > 0)
    @checkout_message = (@gOrderInProgress.includes_reserved_vouchers? ? Option.precheckout_popup : '')
Severity: Minor
Found in app/controllers/store_controller.rb - About 25 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 assign_seats has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def assign_seats
    # XHR call with params['seats'] = JSON array of selected seats, params['vouchers'] =
    #  comma-separated IDs of vouchers
    vouchers = Voucher.find(params[:vouchers].split(/\s*,\s*/))
    seats = params[:seats].split(/\s*,\s*/)
Severity: Minor
Found in app/controllers/seatmaps_controller.rb - About 25 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 merge has a Cognitive Complexity of 6 (exceeds 5 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 25 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 menu_label_function has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def menu_label_function(admin_display = false)
    if admin_display
      single_production ? :date_with_explanation_for_admin : :name_with_explanation_for_admin
    else
      single_production ? :date_with_explanation : :name_with_explanation
Severity: Minor
Found in app/services/voucher_presenter.rb - About 25 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(args={})
    @start_date = (args[:start_date] || Time.current).to_date
    @end_date = (args[:end_date] || Time.current).to_date
    @start_date,@end_date = @end_date,@start_date if @start_date > @end_date
    @hour = (args[:hour] || 0).to_i
Severity: Minor
Found in lib/datetime_range.rb - About 25 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