Skip to content

Commit

Permalink
Layout/HashAlignment
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredbeck committed Jun 20, 2021
1 parent 9cbf58b commit c28c333
Show file tree
Hide file tree
Showing 18 changed files with 189 additions and 166 deletions.
9 changes: 0 additions & 9 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 155
# Cop supports --auto-correct.
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
# SupportedHashRocketStyles: key, separator, table
# SupportedColonStyles: key, separator, table
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
Layout/HashAlignment:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Layout/HeredocIndentation:
Expand Down
3 changes: 2 additions & 1 deletion app/helpers/activity_categories_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module ActivityCategoriesHelper
def button_to_delete cat
button_to "Delete this Category",
cat, :method => "delete",
cat,
:method => "delete",
:data => {:confirm => 'Delete this category and all activities in it? Are you sure?'}
end

Expand Down
4 changes: 3 additions & 1 deletion app/helpers/attendee_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ def plan_selection_inputs plan
end

def plan_date_fields plan, selection
render :partial => 'shared/plan_date_fields',
render(
:partial => 'shared/plan_date_fields',
:locals => {plan: plan, selection: selection}
)
end

def plan_cbx plan, selection
Expand Down
6 changes: 4 additions & 2 deletions app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ class UserMailer < ActionMailer::Base
def welcome_email(user)
@user = user
@year = Year.where(year: user.year).first
mail(:to => user.email,
mail(
:to => user.email,
:reply_to => @year.reply_to_email,
:subject => "Welcome to the #{user.year} U.S. Go Congress")
:subject => "Welcome to the #{user.year} U.S. Go Congress"
)
end
end
3 changes: 2 additions & 1 deletion app/models/activity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class Activity < ApplicationRecord
set the price to 0, so that this #{model_name.human.downcase}
will not show up on invoices."
}
validates :url, :length => {:maximum => 200},
validates :url,
:length => {:maximum => 200},
:format => {
:with => /\Ahttps?:\/{2}/,
:allow_blank => true,
Expand Down
3 changes: 2 additions & 1 deletion app/models/plan_category.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class PlanCategory < ApplicationRecord
has_many :plans

validates :event, :presence => true
validates :name, :presence => true,
validates :name,
:presence => true,
:uniqueness => {
:scope => :year,
:case_sensitive => false,
Expand Down
6 changes: 4 additions & 2 deletions app/models/registration/plan_selection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ def hash

# Gotcha: Notice that dates are not included.
def to_attendee_plan attendee
AttendeePlan.new(:attendee => attendee,
:plan_id => @plan.id, :quantity => @qty, :year => attendee.year)
AttendeePlan.new(
:attendee => attendee,
:plan_id => @plan.id, :quantity => @qty, :year => attendee.year
)
end

private
Expand Down
6 changes: 4 additions & 2 deletions app/models/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class Transaction < ApplicationRecord
validates :updated_by_user, :presence => true, :on => :update

validates_presence_of :instrument, :if => :requires_instrument?
validates_inclusion_of :instrument, :in => [nil, ''], :if => :forbids_instrument?, \
validates_inclusion_of :instrument,
:in => [nil, ''], :if => :forbids_instrument?, \
:message => "must be blank. (Not applicable for selected transaction type)"
validates_length_of :instrument, :is => 1, :if => :requires_instrument?
validates_inclusion_of :instrument, :in => INSTRUMENTS.flatten, :if => :requires_instrument?
Expand Down Expand Up @@ -56,7 +57,8 @@ class Transaction < ApplicationRecord
validates_numericality_of :check_number, :greater_than => 0, :if => :requires_check_number?

# Only refunds may have a check number
validates_inclusion_of :check_number, :unless => :requires_check_number?, \
validates_inclusion_of :check_number,
:unless => :requires_check_number?, \
:allow_nil => false, :allow_blank => false, :in => [nil, ''], \
:message => "must be blank. (Only applicable for Refunds)"

Expand Down
9 changes: 5 additions & 4 deletions db/migrate/20110719022229_migrate_us_open_attendees.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
class MigrateUsOpenAttendees < ActiveRecord::Migration

# Faux model protects against validations which may be added in future
class Tournament < ActiveRecord::Base
end

def up
usopen = Tournament.find_by_name 'US Open'
unless usopen.present?
usopen = Tournament.create!(name:'US Open',
usopen = Tournament.create!(
name: 'US Open',
eligible: 'Anyone',
description: 'The national championship',
directors: 'TBA',
openness: 'O')
openness: 'O'
)
end
execute <<-EOQ
insert into attendee_tournaments (attendee_id, tournament_id)
Expand Down
23 changes: 13 additions & 10 deletions db/migrate/20111210051015_replace_is_player.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class ReplaceIsPlayer < ActiveRecord::Migration

# Faux models protect against validations which may be added in future
# http://guides.rubyonrails.org/migrations.html#using-models-in-your-migrations
# But, if I had to do this again, I'd just write SQL!
Expand All @@ -25,36 +24,40 @@ class Attendee < ActiveRecord::Base
has_many :attendee_plans, :dependent => :destroy
has_many :plans, :through => :attendee_plans
end

def up
# In order to drop attendees.is_player, we must first migrate
# data from 2011, by creating plans and assigning attendees.
# This effort is not necessary in 2012, because we have no
# attendees yet.

# 2011 had a plan category that represented registrations, but
# it was just for show. Attendees were not allowed to select
# the plans in that category.
PlanCategory.yr(2011).where(name: "Registration", show_on_reg_form: false).destroy_all

# Create a new plan category for 2011 to represent registrations.
cat = PlanCategory.yr(2011).create(year: 2011,
cat = PlanCategory.yr(2011).create(
year: 2011,
name: "Registration",
show_on_reg_form: true)

show_on_reg_form: true
)

# The new registration category will have two records:
plan_specs = []
plan_specs << {stem: "Player", price: 375}
plan_specs << {stem: "Non-Player", price: 75}
plan_specs.each do |p|
plan_name = "#{p[:stem]} Registration"
cat.plans.create(year: 2011,
cat.plans.create(
year: 2011,
name: plan_name,
price: p[:price],
age_min: 0,
description: plan_name)
description: plan_name
)
end

# Check that the category has the expected number of plans
unless cat.plans.count == plan_specs.count
raise "Expected #{plan_specs.count} plans in category, found #{cat.plans.count}"
Expand Down
20 changes: 10 additions & 10 deletions db/migrate/20130923073837_insert_2014_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ def up
# error.
Year.create(
{
city: 'TBD',
date_range: 'TBD',
day_off_date: Date.new(2014, 8, 2),
ordinal_number: 30,
registration_phase: 'closed',
reply_to_email: '[email protected]',
start_date: Date.new(2014, 8, 1),
state: 'TBD',
timezone: 'Eastern Time (US & Canada)',
year: 2014
city: 'TBD',
date_range: 'TBD',
day_off_date: Date.new(2014, 8, 2),
ordinal_number: 30,
registration_phase: 'closed',
reply_to_email: '[email protected]',
start_date: Date.new(2014, 8, 1),
state: 'TBD',
timezone: 'Eastern Time (US & Canada)',
year: 2014
},
:without_protection => true
)
Expand Down
Loading

0 comments on commit c28c333

Please sign in to comment.