Skip to content

Commit

Permalink
Fix violations of rubocop Style/SpaceBeforeBlockBraces.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashercodeorg committed Mar 21, 2017
1 parent face66f commit 65a46d3
Show file tree
Hide file tree
Showing 167 changed files with 306 additions and 306 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require_relative 'deployment'

Rake::TaskManager.record_task_metadata = true
Dir.glob(File.join(__dir__, 'lib/rake/*.rake')).sort.each{|rake| import rake}
Dir.glob(File.join(__dir__, 'lib/rake/*.rake')).sort.each {|rake| import rake}

task :default do
# Output a list of tasks without performance hit shelling out to `rake -T`.
Expand Down
2 changes: 1 addition & 1 deletion aws/cloudformation/update_certs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ end
domain = ARGV[0]
`acmesmith current #{domain} 2>&1`
unless $?.success?
required_certs = ['', 'dashboard-', 'origin-'].map{|prefix| prefix + domain}
required_certs = ['', 'dashboard-', 'origin-'].map {|prefix| prefix + domain}
CDO.log.info "Authorizing SSL certificates for subdomain: #{domain}"
required_certs.each do |auth|
CDO.log.info `acmesmith authorize #{auth}`
Expand Down
2 changes: 1 addition & 1 deletion bin/cron/create_rollup_tables
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def main
end

LevelSource.
where(level_id: contained_levels.map{|row| row[:contained_level_id]}).
where(level_id: contained_levels.map {|row| row[:contained_level_id]}).
find_each do |level_source|
level_sources_multi_types << {
level_source_id: level_source.id,
Expand Down
6 changes: 3 additions & 3 deletions bin/cron/deliver_poste_messages
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RETRYABLE_ERROR_MESSAGES = [
'Temporary authentication failure',
'end of file reached'
].map(&:freeze).freeze
RETRYABLE_ERROR_MESSAGE_MATCH = Regexp.new RETRYABLE_ERROR_MESSAGES.map{|m| "(#{m})"}.join('|')
RETRYABLE_ERROR_MESSAGE_MATCH = Regexp.new RETRYABLE_ERROR_MESSAGES.map {|m| "(#{m})"}.join('|')

SMTP_OPTIONS = {
address: CDO.poste_smtp_server,
Expand Down Expand Up @@ -74,7 +74,7 @@ module Poste
params.merge! form.processed_data
params['form'] = form
end
locals = OpenStruct.new(params).instance_eval{binding}
locals = OpenStruct.new(params).instance_eval {binding}

header = @header.result(locals) unless @header.nil?
# TODO(andrew): Fix this so that we get a signal as to how often this is happening.
Expand Down Expand Up @@ -289,7 +289,7 @@ def main
started_at = Time.now

queue = Queue.new.tap do |results|
POSTE_DB[:poste_deliveries].where(sent_at: nil).limit(BATCH_SIZE).reverse_order(:id).each{|i| results << i}
POSTE_DB[:poste_deliveries].where(sent_at: nil).limit(BATCH_SIZE).reverse_order(:id).each {|i| results << i}
end

queue_count = queue.length
Expand Down
2 changes: 1 addition & 1 deletion bin/cron/mysql-metrics
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require 'aws-sdk'

STATUS_CACHE = pegasus_dir('cache', 'mysql-status-cache.json')

status = PEGASUS_DB.fetch('show global status').all.map{|x| [x[:Variable_name], x[:Value]]}.to_h
status = PEGASUS_DB.fetch('show global status').all.map {|x| [x[:Variable_name], x[:Value]]}.to_h
old_status = File.file?(STATUS_CACHE) ? JSON.parse(IO.read(STATUS_CACHE)) : {}
IO.write STATUS_CACHE, JSON.pretty_generate(status)

Expand Down
2 changes: 1 addition & 1 deletion bin/cron/process_forms
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def send_receipts(kind, form)
receipts << kind.receipt(JSON.load(form[:data]))
end
end
receipts = receipts.flatten.select{|i| i}
receipts = receipts.flatten.select {|i| i}
return 0 if receipts.empty?
return 0 if form[:email] == 'anonymous@code.org'

Expand Down
4 changes: 2 additions & 2 deletions bin/cron/push_latest_rds_backup_to_secondary_account
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ def main
rds_backup = Aws::RDS::Resource.new(credentials: credentials_backup)
backup_account_id = Aws::STS::Client.new(credentials: credentials_backup).get_caller_identity.account

production_instance = rds_primary.db_instances.find{ |i| i.id == 'production' }
production_instance = rds_primary.db_instances.find { |i| i.id == 'production' }

# Find the latest automated backup
sorted_snapshots = production_instance.snapshots.
select{ |snap| snap.status == 'available' && !snap.snapshot_id.start_with?('temp-snapshot-') }.
select { |snap| snap.status == 'available' && !snap.snapshot_id.start_with?('temp-snapshot-') }.
sort_by(&:snapshot_create_time)
latest_snapshot = sorted_snapshots.last

Expand Down
2 changes: 1 addition & 1 deletion bin/dotd
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ end
def view_commits(base:, head:)
commit_list = GitHub.
compare(base: base, head: head).
map{|msg| dim msg.lines.first}.
map {|msg| dim msg.lines.first}.
join("\n ")
puts <<-EOS.unindent_with_indent(2)
Commits in #{head} to be merged into #{base}
Expand Down
2 changes: 1 addition & 1 deletion bin/flush_cache
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require 'cdo/rake_utils'
require 'cdo/aws/cloudfront'

require 'sshkit'
SSHKit::Backend::Netssh.configure{|ssh| ssh.ssh_options = {paranoid: false}}
SSHKit::Backend::Netssh.configure {|ssh| ssh.ssh_options = {paranoid: false}}

varnish_ban_cmd = "sudo varnishadm -T localhost:6082 -S /etc/varnish/secret 'ban obj.status ~ .'"
CDO.log.info 'Flushing Varnish cache on daemon...'
Expand Down
2 changes: 1 addition & 1 deletion bin/k5-professional-development-survey-results
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def main
keys = data.keys
puts CSV.generate_line keys
end
puts CSV.generate_line keys.map{|i| data[i]}
puts CSV.generate_line keys.map {|i| data[i]}
end
end

Expand Down
2 changes: 1 addition & 1 deletion bin/ls_frontend_servers
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ if __FILE__ == $0
if json_format
puts output.to_json
else
output.each{|k, v| puts "#{k}\t#{v}" }
output.each {|k, v| puts "#{k}\t#{v}" }
end
end
6 changes: 3 additions & 3 deletions bin/mail/2016-03-29-ny-cs4all/generate-list-functions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def query_dashboard_teachers(query)

def query_k5_pd_section_ids
DB[:forms].where(kind: 'ProfessionalDevelopmentWorkshop').map(:data).
map{|form_data| JSON.parse(form_data)['section_id_s']}.reject(&:blank?).map(&:to_i)
map {|form_data| JSON.parse(form_data)['section_id_s']}.reject(&:blank?).map(&:to_i)
end

# A. Query Code Studio teachers who have already been through the K-5 PD.
Expand Down Expand Up @@ -55,7 +55,7 @@ def query_non_pd_teachers(k5_pd_teachers)
SQL
puts "#{ops_pd_teachers.length} @schools.nyc.gov ops-pd teachers."

all_pd_teachers_ids = k5_pd_teachers.merge(ops_pd_teachers).values.map{|teacher| teacher[:id]}
all_pd_teachers_ids = k5_pd_teachers.merge(ops_pd_teachers).values.map {|teacher| teacher[:id]}
non_pd_teachers = query_dashboard_teachers <<-SQL
SELECT DISTINCT users.email, users.name
FROM users
Expand All @@ -76,7 +76,7 @@ def query_hoc_organizers_no_code_studio

hoc_organizer_code_studio_users = query_dashboard_teachers %Q(
SELECT email FROM users
WHERE email IN (#{hoc_organizers.keys.map{|email| "'#{email}'"}.join(',')})
WHERE email IN (#{hoc_organizers.keys.map {|email| "'#{email}'"}.join(',')})
)
puts "#{hoc_organizer_code_studio_users.length} of those are code studio users."

Expand Down
2 changes: 1 addition & 1 deletion bin/mail/2016-05-02-petition-followup/generate-list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
test_query_succeeded = false
results = {}
teachers.keys.each_slice(10000) do |teacher_emails|
email_list = teacher_emails.map{|email| "\"#{email}\""}.join(',')
email_list = teacher_emails.map {|email| "\"#{email}\""}.join(',')

# Run a test query with inner join to make sure we have click-through results before filtering
unless test_query_succeeded
Expand Down
2 changes: 1 addition & 1 deletion bin/mail/2017-01-05-go-beyond-an-hour/generate-list
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ query_teachers_no_pd

puts "#{@results.count} total contacts:"
CATEGORIES.each do |category|
puts " #{category}: #{@results.values.count{|v| v[:category] == category}}"
puts " #{category}: #{@results.values.count {|v| v[:category] == category}}"
end

export_contacts_to_csv @results, 'contacts.csv'
2 changes: 1 addition & 1 deletion bin/mail/2017-01-19-new-york-PD/generate-list
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ query_teachers_no_pd

puts "#{@results.count} total contacts:"
CATEGORIES.each do |category|
puts " #{category}: #{@results.values.count{|v| v[:category] == category}}"
puts " #{category}: #{@results.values.count {|v| v[:category] == category}}"
end

export_contacts_to_csv @results, 'contacts.csv'
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def export_results
CSV.open(out_filename, 'wb') do |csv|
csv << columns
results.each do |result|
csv << columns.map{|column| result[column]}
csv << columns.map {|column| result[column]}
end
end
end
Expand Down Expand Up @@ -158,7 +158,7 @@ def process(decision, teacher_application, params = {})
end

def teachercon?(workshop_string)
TEACHER_CONS.any?{|tc| workshop_string.include? tc}
TEACHER_CONS.any? {|tc| workshop_string.include? tc}
end

def process_accept(teacher_application, program, accepted_workshop, regional_partner_override)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion bin/mail/hoc-2015-survey/export-survey-results
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ CSV.open('HocSurvey2015-results.csv', 'wb') do |csv|

emails.add form[:email]
skipped_emails.delete form[:email]
csv << columns.map{|column| data[column]}
csv << columns.map {|column| data[column]}
end
end

Expand Down
2 changes: 1 addition & 1 deletion bin/mail/mailing-1-29-white-house/generate-us-petition
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require_relative '../mailing-common/mailing-list-utils'
require 'set'

# ALL U.S. petition signers
us_petition = query_subscribed_contacts(q: 'kind_s:Petition').select{|_, contact| contact[:international] == 'false'}
us_petition = query_subscribed_contacts(q: 'kind_s:Petition').select {|_, contact| contact[:international] == 'false'}

puts "#{us_petition.count} US petition signers"
export_contacts_to_csv us_petition, 'us-petition.csv'
2 changes: 1 addition & 1 deletion bin/mail/mailing-1-29-white-house/generate-us-teacher
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ query_subscribed_contacts(q: 'kind_s:user && role_s:teacher')
query_subscribed_contacts(q: 'kind_s:HocSignup2015 || kind_s:HocSignup2014')

# Filter to US-only
us_teachers = ALL.select{|_, contact| contact[:international] == 'false'}
us_teachers = ALL.select {|_, contact| contact[:international] == 'false'}

puts "#{us_teachers.count} US teachers"
export_contacts_to_csv us_teachers, 'us-teacher.csv'
2 changes: 1 addition & 1 deletion bin/mail/mailing-common/mail_query_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Use this class as the base class for your tests
class MailQueryTestCase < Minitest::Test
def run(*args, &block)
Sequel.transaction([DB, DASHBOARD_DB], rollback: :always){super}
Sequel.transaction([DB, DASHBOARD_DB], rollback: :always) {super}
self
end
end
4 changes: 2 additions & 2 deletions bin/mail/mailing-common/mailing-list-utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down Expand Up @@ -197,7 +197,7 @@ def query_from_list(queries)
# query_subscribed_contacts dedupes by rejecting duplicate emails.
queries.each do |category, query|
new_contacts = query_subscribed_contacts(q: query)
new_contacts.each_value{|contact| contact[:category] = category}
new_contacts.each_value {|contact| contact[:category] = category}
puts "#{category}: #{new_contacts.count} contacts"
contacts.merge! new_contacts
end
Expand Down
4 changes: 2 additions & 2 deletions bin/mail/mailing-common/subtract
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ out_path = ARGV[-1]
# load the emails to remove
emails_to_remove = Set.new
remove_paths.each do |remove_path|
emails_to_remove += CSV.read(remove_path, headers: true).map{|row| row['email']}
emails_to_remove += CSV.read(remove_path, headers: true).map {|row| row['email']}
end

columns = nil
Expand All @@ -32,6 +32,6 @@ CSV.open(out_path, 'wb', headers: true) do |output_csv|
output_csv << columns
end
next if emails_to_remove.include? input_row['email']
output_csv << columns.map{|column| input_row[column]}
output_csv << columns.map {|column| input_row[column]}
end
end
2 changes: 1 addition & 1 deletion bin/mail/old-isolated-scripts/generate-mailing-list
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion bin/mail/old-isolated-scripts/generate-mailing-list-cities
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion bin/mail/old-isolated-scripts/generate-mailing-list-nyc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def export_contacts_to_csv(contacts, path)
columns = contact.keys
results << columns
end
results << columns.map{|column| contact[column]}
results << columns.map {|column| contact[column]}
end
end
end
Expand Down
Loading

0 comments on commit 65a46d3

Please sign in to comment.