Skip to content

Commit 311c0d6

Browse files
committed
fix rubocop offenses
1 parent 616cc47 commit 311c0d6

31 files changed

+156
-172
lines changed

.rubocop.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ Style/AndOr:
4545
Style/Not:
4646
Enabled: false
4747

48+
Style/SingleSpaceBeforeFirstArg:
49+
Enabled: false
50+
4851
Documentation:
49-
Enabled: false # TODO: Enable again once we have more docs
52+
Enabled: false
5053

5154
Style/CaseIndentation:
5255
IndentWhenRelativeTo: case

Gemfile

+45-45
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,63 @@
1-
source 'https://rubygems.org'
1+
source "https://rubygems.org"
22

3-
ruby '2.1.5'
3+
ruby "2.1.5"
44

5-
gem 'rails', '4.2.0'
5+
gem "rails", "4.2.0"
66

7-
gem 'sass-rails', '~> 5.0'
8-
gem 'uglifier', '>= 1.3.0'
9-
gem 'coffee-rails', '~> 4.1.0'
10-
gem 'jquery-rails'
11-
gem 'foundation-rails'
12-
gem 'turbolinks'
13-
gem 'bower-rails'
7+
gem "sass-rails", "~> 5.0"
8+
gem "uglifier", ">= 1.3.0"
9+
gem "coffee-rails", "~> 4.1.0"
10+
gem "jquery-rails"
11+
gem "foundation-rails"
12+
gem "turbolinks"
13+
gem "bower-rails"
1414

15-
gem 'high_voltage'
16-
gem 'omniauth'
17-
gem 'omniauth-oauth2'
15+
gem "high_voltage"
16+
gem "omniauth"
17+
gem "omniauth-oauth2"
1818

19-
gem 'pg'
20-
gem 'puma'
21-
gem 'devise'
19+
gem "pg"
20+
gem "puma"
21+
gem "devise"
2222

23-
gem 'pundit'
24-
gem 'simple_form'
23+
gem "pundit"
24+
gem "simple_form"
2525

2626
group :development do
27-
gem 'better_errors'
28-
gem 'binding_of_caller', :platforms=>[:mri_21]
29-
gem 'foreman'
30-
gem 'guard-bundler'
31-
gem 'guard-rails'
32-
gem 'guard-rspec'
33-
gem 'quiet_assets'
34-
gem 'rails_layout'
35-
gem 'rb-fchange', :require=>false
36-
gem 'rb-fsevent', :require=>false
37-
gem 'rb-inotify', :require=>false
38-
gem 'spring-commands-rspec'
27+
gem "better_errors"
28+
gem "binding_of_caller", platforms: [:mri_21]
29+
gem "foreman"
30+
gem "guard-bundler"
31+
gem "guard-rails"
32+
gem "guard-rspec"
33+
gem "quiet_assets"
34+
gem "rails_layout"
35+
gem "rb-fchange", require: false
36+
gem "rb-fsevent", require: false
37+
gem "rb-inotify", require: false
38+
gem "spring-commands-rspec"
3939
end
4040

4141
group :development, :test do
42-
gem 'factory_girl_rails'
43-
gem 'faker'
44-
gem 'seed-fu'
45-
gem 'pry-rails'
46-
gem 'pry-rescue'
47-
gem 'pry-byebug'
48-
gem 'rspec-rails'
49-
gem 'rubocop'
50-
gem 'web-console', '~> 2.0'
51-
gem 'spring'
42+
gem "factory_girl_rails"
43+
gem "faker"
44+
gem "seed-fu"
45+
gem "pry-rails"
46+
gem "pry-rescue"
47+
gem "pry-byebug"
48+
gem "rspec-rails"
49+
gem "rubocop"
50+
gem "web-console", "~> 2.0"
51+
gem "spring"
5252
end
5353

5454
group :production do
55-
gem 'rails_12factor'
55+
gem "rails_12factor"
5656
end
5757

5858
group :test do
59-
gem 'capybara'
60-
gem 'database_cleaner'
61-
gem 'launchy'
62-
gem 'selenium-webdriver'
59+
gem "capybara"
60+
gem "database_cleaner"
61+
gem "launchy"
62+
gem "selenium-webdriver"
6363
end

Rakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Add your own tasks in files placed in lib/tasks ending in .rake,
22
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
33

4-
require File.expand_path('../config/application', __FILE__)
4+
require File.expand_path("../config/application", __FILE__)
55

66
Rails.application.load_tasks

app/helpers/application_helper.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
module ApplicationHelper
2-
32
def memberful_signup_path
43
"https://rosskaff-example.memberful.com/register"
54
end

app/models/user.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class User < ActiveRecord::Base
22
enum role: [:user, :vip, :admin]
3-
after_initialize :set_default_role, :if => :new_record?
3+
after_initialize :set_default_role, if: :new_record?
44

55
def set_default_role
66
if User.count == 0
@@ -13,23 +13,23 @@ def set_default_role
1313
def attributes_from_omniauth=(auth)
1414
self.uid ||= auth.uid
1515
self.provider ||= auth.provider
16+
info = auth.info
17+
extra = auth.extra
1618

17-
if info = auth.info
19+
# rubocop: disable Style/GuardClause
20+
if info
1821
self.username = info.nickname
1922
self.name = info.name
2023
self.first_name = info.first_name
2124
self.last_name = info.last_name
2225
self.email = info.email
2326
end
2427

25-
if extra = auth.extra and
26-
raw_info = extra.raw_info and
27-
member = raw_info.member
28-
28+
if extra && extra.raw_info && extra.raw_info.member
2929
self.membership_created_at = Time.at(member.created_at)
3030
self.unrestricted_access = member.unrestricted_access
3131
self.stripe_customer_id = member.stripe_customer_id
3232
end
33+
# rubocop: enable Style/GuardClause
3334
end
34-
3535
end

config/application.rb

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
require File.expand_path('../boot', __FILE__)
1+
require File.expand_path("../boot", __FILE__)
22

3-
require 'rails/all'
3+
require "rails/all"
44

55
# Require the gems listed in Gemfile, including any gems
6-
# you've limited to :test, :development, or :production.
6+
# you"ve limited to :test, :development, or :production.
77
Bundler.require(*Rails.groups)
88

99
module MemberfulExample
1010
class Application < Rails::Application
11-
1211
config.generators do |g|
1312
g.test_framework :rspec,
1413
fixtures: true,
@@ -26,14 +25,14 @@ class Application < Rails::Application
2625

2726
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
2827
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
29-
# config.time_zone = 'Central Time (US & Canada)'
28+
# config.time_zone = "Central Time (US & Canada)"
3029

3130
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
32-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
31+
# config.i18n.load_path += Dir[Rails.root.join("my", "locales", "*.{rb,yml}").to_s]
3332
# config.i18n.default_locale = :de
3433

3534
# For Foundation 5
36-
config.assets.precompile += %w( vendor/modernizr )
35+
config.assets.precompile += %w[vendor/modernizr]
3736

3837
# Do not swallow errors in after_commit/after_rollback callbacks.
3938
config.active_record.raise_in_transactional_callbacks = true

config/boot.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
1+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
22

3-
require 'bundler/setup' # Set up gems listed in the Gemfile.
3+
require "bundler/setup" # Set up gems listed in the Gemfile.

config/environment.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Load the Rails application.
2-
require File.expand_path('../application', __FILE__)
2+
require File.expand_path("../application", __FILE__)
33

44
# Initialize the Rails application.
55
Rails.application.initialize!

config/environments/development.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Rails.application.configure do
22
# Settings specified here will take precedence over those in config/application.rb.
33

4-
# In the development environment your application's code is reloaded on
4+
# In the development environment your application"s code is reloaded on
55
# every request. This slows down response time but is perfect for development
6-
# since you don't have to restart the web server when you make code changes.
6+
# since you don"t have to restart the web server when you make code changes.
77
config.cache_classes = false
88

99
# Do not eager load code on boot.
@@ -13,7 +13,7 @@
1313
config.consider_all_requests_local = true
1414
config.action_controller.perform_caching = false
1515

16-
# Don't care if the mailer can't send.
16+
# Don"t care if the mailer can"t send.
1717
config.action_mailer.raise_delivery_errors = false
1818

1919
# Print deprecation notices to the Rails logger.
@@ -37,7 +37,7 @@
3737
password: Rails.application.secrets.email_provider_apikey
3838
}
3939
# ActionMailer Config
40-
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
40+
config.action_mailer.default_url_options = { host: "localhost:3000" }
4141
config.action_mailer.delivery_method = :smtp
4242
config.action_mailer.raise_delivery_errors = true
4343
# Send email in development mode?

config/environments/production.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
# Disable serving static files from the `/public` folder by default since
2424
# Apache or NGINX already handles this.
25-
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
25+
config.serve_static_files = ENV["RAILS_SERVE_STATIC_FILES"].present?
2626

2727
# Compress JavaScripts and CSS.
2828
config.assets.js_compressor = :uglifier
@@ -38,8 +38,8 @@
3838
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
3939

4040
# Specifies the header that your server uses for sending files.
41-
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
41+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
42+
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
4343

4444
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
4545
# config.force_ssl = true
@@ -58,7 +58,7 @@
5858
# config.cache_store = :mem_cache_store
5959

6060
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
61-
# config.action_controller.asset_host = 'http://assets.example.com'
61+
# config.action_controller.asset_host = "http://assets.example.com"
6262

6363
# Ignore bad email addresses and do not raise email delivery errors.
6464
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
@@ -81,7 +81,7 @@
8181
password: Rails.application.secrets.email_provider_apikey
8282
}
8383
# ActionMailer Config
84-
config.action_mailer.default_url_options = { :host => Rails.application.secrets.domain_name }
84+
config.action_mailer.default_url_options = { host: Rails.application.secrets.domain_name }
8585
config.action_mailer.delivery_method = :smtp
8686
config.action_mailer.perform_deliveries = true
8787
config.action_mailer.raise_delivery_errors = false

config/environments/test.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Rails.application.configure do
22
# Settings specified here will take precedence over those in config/application.rb.
33

4-
# The test environment is used exclusively to run your application's
4+
# The test environment is used exclusively to run your application"s
55
# test suite. You never need to work with it otherwise. Remember that
66
# your test database is "scratch space" for the test suite and is wiped
7-
# and recreated between test runs. Don't rely on the data there!
7+
# and recreated between test runs. Don"t rely on the data there!
88
config.cache_classes = true
99

1010
# Do not eager load code on boot. This avoids loading your whole application
@@ -14,7 +14,7 @@
1414

1515
# Configure static file server for tests with Cache-Control for performance.
1616
config.serve_static_files = true
17-
config.static_cache_control = 'public, max-age=3600'
17+
config.static_cache_control = "public, max-age=3600"
1818

1919
# Show full error reports and disable caching.
2020
config.consider_all_requests_local = false

config/initializers/assets.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Be sure to restart your server when you modify this file.
22

33
# Version of your assets, change this if you want to expire all your assets.
4-
Rails.application.config.assets.version = '1.0'
4+
Rails.application.config.assets.version = "1.0"
55

66
# Add additional assets to the asset load path
77
# Rails.application.config.assets.paths << Emoji.images_path

config/initializers/bower_rails.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BowerRails.configure do |bower_rails|
22
# Tell bower-rails what path should be considered as root. Defaults to Dir.pwd
3-
# bower_rails.root_path = Dir.pwd
3+
bower_rails.root_path = Dir.pwd
44

55
# Invokes rake bower:install before precompilation. Defaults to false
66
# bower_rails.install_before_precompile = true
@@ -10,7 +10,7 @@
1010

1111
# Invokes rake bower:clean before precompilation. Defaults to false
1212
# bower_rails.clean_before_precompile = true
13-
13+
1414
# Invokes rake bower:install:deployment instead rake bower:install. Defaults to false
1515
# bower_rails.use_bower_install_deployment = true
1616
end

0 commit comments

Comments
 (0)