Skip to content

Commit 2cf8bcc

Browse files
committed
Reverted Rubocop (for now)
1 parent e5d36d1 commit 2cf8bcc

File tree

412 files changed

+3516
-3337
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

412 files changed

+3516
-3337
lines changed

Gemfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,8 @@ group :development do
140140
gem 'better_errors'
141141
gem 'flog'
142142
gem 'fukuzatsu'
143-
gem 'git_stats', require: false
144143
gem 'guard-rspec'
145144
gem 'rails-erd'
146-
gem 'rubocop'
147145
gem 'spring'
148146
gem 'spring-commands-rspec'
149147
gem 'travis'

Gemfile.lock

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,6 @@ GEM
267267
multi_json (~> 1.0)
268268
net-http-persistent (>= 2.7)
269269
net-http-pipeline
270-
git_stats (1.0.8)
271-
actionpack
272-
activesupport
273-
haml
274-
i18n
275-
lazy_high_charts
276-
thor
277-
tilt
278270
github-markdown (0.6.5)
279271
grackle (0.3.0)
280272
json
@@ -300,7 +292,6 @@ GEM
300292
sprockets
301293
tilt
302294
handlebars-source (1.3.0)
303-
hash-deep-merge (0.1.1)
304295
hashie (1.2.0)
305296
hashr (0.0.22)
306297
heroku_rails_deflate (1.0.3)
@@ -339,9 +330,6 @@ GEM
339330
kramdown (1.4.0)
340331
launchy (2.4.2)
341332
addressable (~> 2.3)
342-
lazy_high_charts (1.5.4)
343-
bundler (>= 1.0)
344-
hash-deep-merge
345333
linkedin (0.4.6)
346334
hashie (>= 1.2, < 2.1)
347335
multi_json (~> 1.0)
@@ -453,7 +441,6 @@ GEM
453441
polyglot (0.3.5)
454442
poro_plus (1.0.2)
455443
posix-spawn (0.3.8)
456-
powerpack (0.0.9)
457444
pry (0.9.12.6)
458445
coderay (~> 1.0)
459446
method_source (~> 0.8)
@@ -529,7 +516,6 @@ GEM
529516
rake (>= 0.8.7)
530517
rdoc (~> 3.4)
531518
thor (>= 0.14.6, < 2.0)
532-
rainbow (2.0.0)
533519
rake (10.3.2)
534520
rakismet (1.5.0)
535521
rb-fsevent (0.9.4)
@@ -585,12 +571,6 @@ GEM
585571
rspec-mocks (~> 3.0.0)
586572
rspec-support (~> 3.0.0)
587573
rspec-support (3.0.2)
588-
rubocop (0.23.0)
589-
json (>= 1.7.7, < 2)
590-
parser (~> 2.1.9)
591-
powerpack (~> 0.0.6)
592-
rainbow (>= 1.99.1, < 3.0)
593-
ruby-progressbar (~> 1.4)
594574
ruby-graphviz (1.0.9)
595575
ruby-progressbar (1.5.1)
596576
ruby_parser (3.6.1)
@@ -738,7 +718,6 @@ DEPENDENCIES
738718
fukuzatsu
739719
fuubar (= 2.0.0.rc1)
740720
geocoder
741-
git_stats
742721
github-markdown
743722
grackle
744723
guard-rspec
@@ -800,7 +779,6 @@ DEPENDENCIES
800779
rest-client
801780
rocket_tag
802781
rspec-rails
803-
rubocop
804782
ruby-progressbar
805783
sanitize
806784
sass (~> 3.2.9)

app/controllers/accounts_controller.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def update
4848

4949
def webhook
5050
data = JSON.parse request.body.read
51-
if data[:type] == 'invoice.payment_succeeded'
51+
if data[:type] == "invoice.payment_succeeded"
5252
invoice_id = data['data']['object']['id']
5353
customer_id = data['data']['object']['customer']
5454
team = Team.where('account.stripe_customer_token' => customer_id).first
@@ -64,7 +64,7 @@ def webhook
6464
def send_invoice
6565
@team = Team.find(params[:team_id])
6666
@team.account.send_invoice_for(1.month.ago)
67-
redirect_to teamname_path(slug: @team.slug), notice: "sent invoice for #{1.month.ago.strftime('%B')} to #{@team.account.admin.email}"
67+
redirect_to teamname_path(slug: @team.slug), notice: "sent invoice for #{1.month.ago.strftime("%B")} to #{@team.account.admin.email}"
6868
end
6969

7070
private
@@ -84,20 +84,21 @@ def determine_plan
8484
end
8585

8686
def ensure_eligibility
87-
return redirect_to(teamname_path(@team.slug), notice: 'you must complete at least 6 sections of the team profile before posting jobs') unless @team.has_specified_enough_info?
87+
return redirect_to(teamname_path(@team.slug), notice: "you must complete at least 6 sections of the team profile before posting jobs") unless @team.has_specified_enough_info?
8888
end
8989

9090
def plan_capability(plan, team)
91-
message = ''
91+
message = ""
9292
if plan.subscription?
9393
message = "You can now post up to #{team.number_of_jobs_to_show} jobs at any time"
9494
elsif plan.one_time?
95-
message = 'You can now post one job for 30 days'
95+
message = "You can now post one job for 30 days"
9696
end
9797
message
9898
end
9999

100100
def paying_user_context
101101
Honeybadger.context(user_email: current_user.try(:email)) if current_user
102102
end
103+
103104
end

app/controllers/achievements_controller.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def show
1414
end
1515

1616
def award
17+
1718
award_params = params.permit(:badge, :twitter, :linkedin, :github, :date)
1819

1920
provider = pick_a_provider(award_params)
@@ -34,23 +35,23 @@ def award
3435
return render json: { message: "don't have permission to do that. contact support@coderwall.com", status: 403 }.to_json
3536
end
3637
end
37-
rescue => e
38-
return render json: { message: 'something went wrong with your request or the end point may not be ready. contact support@coderwall.com' }.to_json
38+
rescue Exception => e
39+
return render json: { message: "something went wrong with your request or the end point may not be ready. contact support@coderwall.com" }.to_json
3940
end
4041

4142
private
4243

4344
def ensure_valid_api_key
4445
@api_key = params.permit(:api_key)[:api_key]
4546
@api_access = ApiAccess.for(@api_key) unless @api_key.nil?
46-
return render json: { message: 'no/invalid api_key provided. get your api_key from coderwall.com/settings' }.to_json if @api_access.nil?
47+
return render json: { message: "no/invalid api_key provided. get your api_key from coderwall.com/settings" }.to_json if @api_access.nil?
4748
end
4849

4950
def badge_class_factory(requested_badge_name)
5051
BADGES_LIST.select { |badge_name| badge_name == requested_badge_name }.first.constantize
5152
end
5253

5354
def pick_a_provider(award_params)
54-
(User::LINKABLE_PROVIDERS & award_params.keys.select { |key| %w(twitter linkedin github).include?(key) }).first
55+
(User::LINKABLE_PROVIDERS & award_params.keys.select { |key| %w{twitter linkedin github}.include?(key) }).first
5556
end
5657
end

app/controllers/admin_controller.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
class AdminController < BaseAdminController
2+
23
def index
34
end
45

@@ -11,14 +12,14 @@ def failed_jobs
1112
@per_page = params[:per_page].try(:to_i) || 10
1213

1314
@total_failed = Delayed::Job.
14-
where('last_error IS NOT NULL').
15+
where("last_error IS NOT NULL").
1516
count
1617

1718
@jobs = Delayed::Job.
18-
where('last_error IS NOT NULL').
19+
where("last_error IS NOT NULL").
1920
offset((@page - 1) * @per_page).
2021
limit(@per_page).
21-
order('updated_at DESC')
22+
order("updated_at DESC")
2223
end
2324

2425
if Rails.env.development?
@@ -31,12 +32,13 @@ def toggle_premium_team
3132
end
3233
team.premium = !team.premium
3334
team.save!
34-
redirect_to('/')
35+
return redirect_to('/')
3536
end
3637

3738
end
3839

3940
def teams
41+
4042
end
4143

4244
def sections_teams

app/controllers/alerts_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def authenticate_caller
3434

3535
case @alert[:type].to_sym
3636
when :traction, :google_analytics
37-
valid = (@alert[:key] == '3fEtu89_W13k1')
37+
valid = (@alert[:key] == "3fEtu89_W13k1")
3838
else
3939
valid = false
4040
end
@@ -78,7 +78,7 @@ def can_report_traction?(url)
7878
Time.at(REDIS.get(last_sent_key(:traction, url)).to_i) < TRACTION_ALERT_INTERVAL.ago
7979
end
8080

81-
def last_sent_key(type, subkey = nil)
81+
def last_sent_key(type, subkey=nil)
8282
key = "alert:#{type}:last_sent"
8383
key += ":#{subkey}" unless subkey.nil?
8484
key
@@ -99,4 +99,4 @@ def update_stats
9999
def update_history
100100
REDIS.zadd(history_key(@alert[:type]), Time.now.to_i, @alert[:data])
101101
end
102-
end
102+
end

app/controllers/application_controller.rb

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ def apply_flash_message
2828
end
2929

3030
def apply_cache_buster
31-
response.headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate'
32-
response.headers['Pragma'] = 'no-cache'
33-
response.headers['Expires'] = 'Fri, 01 Jan 1990 00:00:00 GMT'
31+
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
32+
response.headers["Pragma"] = "no-cache"
33+
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
3434
end
3535

3636
def clear_expired_cookie_if_session_is_empty
37-
unless signed_in?
37+
if !signed_in?
3838
cookies.delete(:signedin)
3939
end
4040
end
@@ -67,7 +67,7 @@ def sign_in(user)
6767
current_user.last_ip = request.remote_ip
6868
current_user.last_ua = request.user_agent
6969
current_user.save
70-
ensure_and_reconcile_tracking_code # updated tracking code if appropriate.
70+
ensure_and_reconcile_tracking_code #updated tracking code if appropriate.
7171
current_user
7272
end
7373

@@ -97,7 +97,7 @@ def ensure_and_reconcile_tracking_code
9797
end
9898

9999
def sign_out
100-
record_event('signed out')
100+
record_event("signed out")
101101
@current_user = nil
102102
session[:current_user] = nil
103103
cookies.delete(:signedin)
@@ -110,7 +110,7 @@ def store_location!(url = nil)
110110

111111
def require_registration
112112
if signed_in? && not_on_pages?
113-
redirect_to(edit_user_url(current_user)) unless current_user.valid?
113+
redirect_to(edit_user_url(current_user)) if !current_user.valid?
114114
end
115115
end
116116

@@ -137,7 +137,7 @@ def record_location
137137
end
138138

139139
def deployment_environment?
140-
Rails.env.production? || Rails.env.staging?
140+
Rails.env.production? or Rails.env.staging?
141141
end
142142

143143
def destination_url
@@ -158,7 +158,7 @@ def destination_url
158158
end
159159

160160
def access_required
161-
redirect_to(root_url) unless signed_in?
161+
redirect_to(root_url) if !signed_in?
162162
end
163163

164164
def viewing_self?
@@ -174,8 +174,8 @@ def not_on_achievements?
174174
end
175175

176176
unless Rails.env.development? || Rails.env.test?
177-
rescue_from(ActiveRecord::RecordNotFound) { |_e| render_404 }
178-
rescue_from(ActionController::RoutingError) { |_e| render_404 }
177+
rescue_from(ActiveRecord::RecordNotFound) { |e| render_404 }
178+
rescue_from(ActionController::RoutingError) { |e| render_404 }
179179
# rescue_from(RuntimeError) { |e| render_500 }
180180
end
181181

@@ -206,7 +206,7 @@ def require_beta_access!
206206
end
207207

208208
def iphone_user_agent?
209-
request.env['HTTP_USER_AGENT'] && request.env['HTTP_USER_AGENT'][/(Mobile\/.+Safari)/]
209+
request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/(Mobile\/.+Safari)/]
210210
end
211211

212212
def round(number)
@@ -216,7 +216,7 @@ def round(number)
216216
number.round(-1)
217217
elsif number < 1000
218218
number.round(-2)
219-
elsif number < 10_000
219+
elsif number < 10000
220220
number.round(-3)
221221
else
222222
number.round(-Math.log(number, 10))
@@ -228,28 +228,28 @@ def record_event(action_name, options = {})
228228
options.merge!('mp_name_tag' => cookies[:identity]) unless cookies[:identity].blank?
229229
options.merge!('distinct_id' => cookies[:trc]) unless cookies[:trc].blank?
230230
unless current_user.nil?
231-
options.merge!('score' => current_user.score.round(-1),
232-
'followers' => round(current_user.followers_count),
233-
'achievements' => current_user.badges_count,
234-
'on team' => current_user.on_team?,
235-
'premium team' => (current_user.team && current_user.team.premium?) || false,
236-
'signed in' => true,
237-
'member' => true,
238-
'first visit' => false,
239-
'visit frequency' => current_user.visit_frequency)
231+
options.merge!({ 'score' => current_user.score.round(-1),
232+
'followers' => round(current_user.followers_count),
233+
'achievements' => current_user.badges_count,
234+
'on team' => current_user.on_team?,
235+
'premium team' => (current_user.team && current_user.team.premium?) || false,
236+
'signed in' => true,
237+
'member' => true,
238+
'first visit' => false,
239+
'visit frequency' => current_user.visit_frequency })
240240
else
241-
options.merge!('signed in' => false,
242-
'member' => cookies[:identity] && User.exists?(username: cookies[:identity]),
243-
'first visit' => session[:new_visit]
244-
)
241+
options.merge!({ 'signed in' => false,
242+
'member' => cookies[:identity] && User.exists?(username: cookies[:identity]),
243+
'first visit' => session[:new_visit]
244+
})
245245
end
246246

247-
# options.merge!('signed up on' => current_user.created_at.to_formatted_s(:mixpanel),
247+
#options.merge!('signed up on' => current_user.created_at.to_formatted_s(:mixpanel),
248248
# 'achievements' => current_user.badges_count) if signed_in?
249249

250250
Resque.enqueue(MixpanelTracker::TrackEventJob, action_name, options, request.ip) if ENABLE_TRACKING
251251
end
252-
rescue => ex
252+
rescue Exception => ex
253253
Rails.logger.error("MIXPANEL: Swallowing error when trying to record #{action_name}, #{ex.message}")
254254
end
255255

@@ -260,7 +260,7 @@ def session_id
260260
def ensure_domain
261261
if Rails.env.production?
262262
if request.env['HTTP_HOST'] != APP_DOMAIN
263-
redirect_to request.url.sub('//www.', '//'), status: 301
263+
redirect_to request.url.sub("//www.", "//"), status: 301
264264
end
265265
end
266266
end
@@ -288,12 +288,12 @@ def redirect_to_path(path)
288288
end
289289
end
290290

291-
def redirect_to_signup_if_unauthenticated(return_to = request.referer, message = 'You must be signed in to do that', &_block)
291+
def redirect_to_signup_if_unauthenticated(return_to=request.referer, message = "You must be signed in to do that", &block)
292292
if signed_in?
293293
yield
294294
else
295295
flash[:notice] = message
296-
# This is called when someone tries to do an action while unauthenticated
296+
#This is called when someone tries to do an action while unauthenticated
297297
Rails.logger.info "WILL RETURN TO #{return_to}"
298298
store_location!(return_to)
299299
redirect_to_path(signin_path)
@@ -309,4 +309,5 @@ def require_http_basic
309309
end
310310
end
311311
end
312+
312313
end

0 commit comments

Comments
 (0)