Skip to content

Commit

Permalink
Add a little more classiness to OmniauthProviders
Browse files Browse the repository at this point in the history
Additional style shenanigans + .rubocop.yml
  • Loading branch information
tjgrathwell committed Jan 8, 2016
1 parent 5434828 commit e82bcea
Show file tree
Hide file tree
Showing 28 changed files with 336 additions and 126 deletions.
199 changes: 199 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
Lint/BlockAlignment:
Exclude:
- 'lib/tasks/db.rake'

Lint/EndAlignment:
Enabled: false

Lint/ShadowingOuterLocalVariable:
Enabled: false

Lint/UnusedBlockArgument:
Enabled: false

Lint/UnusedMethodArgument:
Enabled: false

Lint/UselessAssignment:
Enabled: false

Metrics/AbcSize:
Max: 160

Metrics/ClassLength:
Max: 500

Metrics/CyclomaticComplexity:
Max: 11

Metrics/LineLength:
Enabled: false

Metrics/MethodLength:
Enabled: false

Metrics/ModuleLength:
Enabled: false

Metrics/PerceivedComplexity:
Max: 12

Performance/Count:
Enabled: false

Performance/Detect:
Enabled: false

Performance/StringReplacement:
Enabled: false

Style/AccessorMethodName:
Enabled: false

Style/AlignArray:
Enabled: false

Style/AlignHash:
Enabled: false

Style/AlignParameters:
Enabled: false

Style/BlockDelimiters:
Enabled: false

Style/BlockEndNewline:
Enabled: false

Style/BracesAroundHashParameters:
Enabled: false

Style/CaseIndentation:
Enabled: false

Style/ClassAndModuleChildren:
Enabled: false

Style/ClosingParenthesisIndentation:
Enabled: false

Style/Documentation:
Enabled: false

Style/DotPosition:
Enabled: false

Style/DoubleNegation:
Enabled: false

Style/ElseAlignment:
Enabled: false

Style/EmptyLines:
Enabled: false

Style/EmptyLinesAroundBlockBody:
Enabled: false

Style/EmptyLinesAroundClassBody:
Enabled: false

Style/EmptyLinesAroundMethodBody:
Enabled: false

Style/EmptyLinesAroundModuleBody:
Enabled: false

Style/ExtraSpacing:
Exclude:
- 'bin/setup'
- 'config.ru'
- 'db/migrate/20131210054655_init_schema.rb'
- 'db/schema.rb'

Style/GuardClause:
Enabled: false

Style/IfUnlessModifier:
Enabled: false

Style/IndentationWidth:
Enabled: false

Style/IndentHash:
EnforcedStyle: consistent

Style/Lambda:
Enabled: false

Style/LeadingCommentSpace:
Enabled: false

Style/MethodDefParentheses:
Enabled: false

Style/MultilineBlockLayout:
Enabled: false

Style/MultilineOperationIndentation:
Enabled: false

Style/NumericLiterals:
MinDigits: 15

Style/ParallelAssignment:
Enabled: false

Style/PredicateName:
Enabled: false

Style/RedundantReturn:
Enabled: false

Style/SelfAssignment:
Enabled: false

Style/SignalException:
Enabled: false

Style/SpaceAroundEqualsInParameterDefault:
Enabled: false

Style/SpaceAroundOperators:
Enabled: false

Style/SpaceBeforeBlockBraces:
Enabled: false

Style/SpaceInsideBlockBraces:
Enabled: false

Style/SpaceInsideBrackets:
Enabled: false

Style/SpaceInsideHashLiteralBraces:
Enabled: false

Style/SpaceInsideParens:
Enabled: false

Style/SingleSpaceBeforeFirstArg:
Enabled: false

Style/SpecialGlobalVars:
Enabled: false

Style/StringLiterals:
Enabled: false

Style/TrailingBlankLines:
Enabled: false

Style/TrailingComma:
Enabled: false

Style/TrailingWhitespace:
Enabled: false

Style/WordArray:
MinSize: 3
2 changes: 1 addition & 1 deletion app/controllers/checkins_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class CheckinsController < ApplicationController

def index
@rsvp_sessions = @session.rsvp_sessions.joins(
rsvp: :bridgetroll_user
rsvp: :bridgetroll_user
).includes([rsvp: :user]).order('users.first_name asc, users.last_name asc, users.email asc')
respond_to do |format|
format.html { @checkin_counts = @event.checkin_counts }
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/rsvps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def edit
end

def update
set_dietary_restrictions(@rsvp, params[:dietary_restrictions])
set_dietary_restrictions(@rsvp, params[:dietary_restrictions])
if @rsvp.update_attributes(rsvp_params)
apply_other_changes_from_params

Expand Down Expand Up @@ -103,7 +103,7 @@ def destroy
protected

def redirect_if_event_closed
if !@event.open?
unless @event.open?
flash[:error] = "Sorry. This event is closed!"
redirect_to @event
end
Expand Down
20 changes: 10 additions & 10 deletions app/helpers/events_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ module EventsHelper
def get_volunteer_skills(volunteer_rsvp)
profile = volunteer_rsvp.user.profile
@skills = []
@skills << 'Teaching' if(volunteer_rsvp.teaching)
@skills << 'TA-ing' if(volunteer_rsvp.taing)
@skills << 'Childcare' if(profile.childcaring)
@skills << 'Writing' if(profile.writing)
@skills << 'Outreach' if(profile.outreach)
@skills << 'Designing' if(profile.designing)
@skills << 'Mentoring' if(profile.mentoring)
@skills << 'Mac OS X' if(profile.macosx)
@skills << 'Windows' if(profile.windows)
@skills << 'Linux' if(profile.linux)
@skills << 'Teaching' if volunteer_rsvp.teaching
@skills << 'TA-ing' if volunteer_rsvp.taing
@skills << 'Childcare' if profile.childcaring
@skills << 'Writing' if profile.writing
@skills << 'Outreach' if profile.outreach
@skills << 'Designing' if profile.designing
@skills << 'Mentoring' if profile.mentoring
@skills << 'Mac OS X' if profile.macosx
@skills << 'Windows' if profile.windows
@skills << 'Linux' if profile.linux
@skills.join(', ')
end

Expand Down
4 changes: 2 additions & 2 deletions app/jobs/reminder_sender.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ def self.send_all_reminders

def self.remind_attendees_for_event(event)
event.event_sessions.where(volunteers_only: true).each do |event_session|
self.remind_attendees_for_session(event_session)
remind_attendees_for_session(event_session)
end

first_everybody_session = event.event_sessions.find_by(volunteers_only: false)
return unless first_everybody_session
return unless first_everybody_session.starts_at < Time.zone.now + 3.days
return unless first_everybody_session.starts_at < Time.zone.now + 3.days

due_reminders = event.rsvps.confirmed.where(reminded_at: nil)
puts "Sending #{due_reminders.count} reminders for #{event.title}..." unless Rails.env.test?
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/survey_sender.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def self.send_all_surveys
Event.where('ends_at > ?', FIRST_AUTO_SEND_DATE)
.where('ends_at < ?', 1.day.ago)
.where('survey_sent_at IS NULL').each do |event|
self.send_surveys(event)
send_surveys(event)
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/mailers/base_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def set_recipients(recipients, cc = nil)
# away from Sendgrid.
# http://sendgrid.com/docs/API_Reference/SMTP_API/

recipients += cc unless cc == nil
recipients += cc unless cc.nil?

headers['X-SMTPAPI'] = {
to: recipients
Expand Down
3 changes: 2 additions & 1 deletion app/models/course.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ class Course < ActiveHash::Base
id: 8,
name: 'BWAG Go Portugues',
title: 'Building Web Apps With Go - Em Portugues',
description: "Se você está lendo isto então você está prestes a embarcar em uma jornada de iniciante a pro. Sério! Programação web em Go é tão divertido e fácil que você nem vai perceber quanta informação você está aprendendo ao longo do curso. Todo o material do curso está aqui: <a href='https://gobridge.gitbooks.io/building-web-apps-with-go/content/pt-br/index.html'>https://gobridge.gitbooks.io/building-web-apps-with-go/content/pt-br/index.html</a>.", levels: [
description: "Se você está lendo isto então você está prestes a embarcar em uma jornada de iniciante a pro. Sério! Programação web em Go é tão divertido e fácil que você nem vai perceber quanta informação você está aprendendo ao longo do curso. Todo o material do curso está aqui: <a href='https://gobridge.gitbooks.io/building-web-apps-with-go/content/pt-br/index.html'>https://gobridge.gitbooks.io/building-web-apps-with-go/content/pt-br/index.html</a>.",
levels: [
{
level: 2,
color: 'green',
Expand Down
2 changes: 1 addition & 1 deletion app/models/dietary_restriction.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class DietaryRestriction < ActiveRecord::Base
belongs_to :rsvp

DIETS = %w{ vegetarian vegan gluten-free dairy-free }
DIETS = %w(vegetarian vegan gluten-free dairy-free)

validates_uniqueness_of :restriction, {scope: :rsvp_id}

Expand Down
10 changes: 5 additions & 5 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Event < ActiveRecord::Base
has_many :sections, dependent: :destroy
has_many :event_emails, dependent: :destroy

has_many :attendee_rsvps, -> { where(role_id: Role.attendee_role_ids, waitlist_position: nil) }, class_name: 'Rsvp', inverse_of: :event
has_many :attendee_rsvps, -> { where(role_id: Role.attendee_role_ids, waitlist_position: nil) }, class_name: 'Rsvp', inverse_of: :event

has_many :student_rsvps, -> { where(role_id: Role::STUDENT.id, waitlist_position: nil) }, class_name: 'Rsvp', inverse_of: :event
has_many :student_waitlist_rsvps, -> { where("role_id = #{Role::STUDENT.id} AND waitlist_position IS NOT NULL").order(:waitlist_position) }, class_name: 'Rsvp', inverse_of: :event
Expand Down Expand Up @@ -91,12 +91,12 @@ def historical?

def close_rsvps
self.open = false
self.save
save
end

def reopen_rsvps
self.open = true
self.save
save
end

def closed?
Expand Down Expand Up @@ -189,7 +189,7 @@ def self.drafted_by(user)
end

def self.published_or_organized_by(user = nil)
return self.published unless user
return published unless user

if user.admin?
where(spam: false)
Expand Down Expand Up @@ -227,7 +227,7 @@ def organizers_with_legacy
end

def rsvp_for_user(user)
self.rsvps.find_by_user_id(user.id)
rsvps.find_by_user_id(user.id)
end

def no_rsvp?(user)
Expand Down
2 changes: 1 addition & 1 deletion app/models/location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Location < ActiveRecord::Base
end

def full_address
"#{self.address_1}, #{self.city}, #{self.state}, #{self.zip}"
"#{address_1}, #{city}, #{state}, #{zip}"
end

def name_with_region
Expand Down
Loading

0 comments on commit e82bcea

Please sign in to comment.