Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RuboCop. Fix Minor Style Issues #429

Merged
merged 2 commits into from
Jun 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
inherit_from: rubocop-todo.yml
inherit_from: .rubocop_todo.yml
AllCops:
Exclude:
- db/**
- vendor/**
- node_modules/**
- db/**/*
- vendor/**/*
- node_modules/**/*
IfUnlessModifier:
Enabled: false
Loop:
Expand Down
24 changes: 24 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2014-06-12 16:30:11 -0400 using RuboCop version 0.23.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 33
Lint/UselessAssignment:
Enabled: false

# Offense count: 19
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:
Enabled: false

# Offense count: 13
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Enabled: false

# Offense count: 1
Style/UnneededCapitalW:
Enabled: false
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ group :test do
end

group :development, :test do
gem 'rubocop'
gem 'rubocop', '>= 0.23.0'
gem 'mail_view'
gem 'quiet_assets'
gem 'rspec-rails'
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/cookbook_uploads_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def destroy
)
end

rescue_from Mixlib::Authentication::AuthenticationError do |e|
rescue_from Mixlib::Authentication::AuthenticationError do |_e|
error(
error_code: t('api.error_codes.authentication_failed'),
error_messages: [t('api.error_messages.authentication_request_error')]
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def not_found!(error = nil)
render 'exceptions/404', options
end

def after_sign_in_path_for(resource)
def after_sign_in_path_for(_resource)
stored_location || root_path
end

Expand Down
2 changes: 1 addition & 1 deletion app/mailers/cookbook_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def follower_notification_email(cookbook_follower)
# @param name [String] the name of the cookbook
# @param email [String] the user to notify
#
def cookbook_deleted_email(name, email)
def cookbook_deleted_email(_name, email)
mail(to: email, subject: 'Chef Supermarket - A cookbook has been deleted.')
end
end
2 changes: 1 addition & 1 deletion app/models/concerns/authorizable.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Authorizable
# The list of roles.
ROLES = %w[admin].freeze
ROLES = %w(admin).freeze

#
# Set the roles on the parent model.
Expand Down
4 changes: 2 additions & 2 deletions app/models/curry/pull_request_annotator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ def existing_labels
#
def failure_message
parts = []
parts << %{
parts << %(
Hi. Your friendly Curry bot here. Just letting you know that there are
commit authors in this Pull Request who appear to not have signed a Chef
CLA.
}.squish
).squish

unknown_commit_authors_with_email_count = @pull_request.unknown_commit_authors.with_known_email.count

Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class User < ActiveRecord::Base
has_many :cookbook_followers
has_many :followed_cookbooks, through: :cookbook_followers, source: :cookbook
has_many :collaborated_cookbooks, through: :cookbook_collaborators, source: :cookbook
has_one :chef_account, -> { self.for('chef_oauth2') }, class_name: 'Account'
has_one :chef_account, -> { self.for('chef_oauth2') }, class_name: 'Account'

# Validations
# --------------------
Expand Down
2 changes: 1 addition & 1 deletion app/workers/oauth_token_refresh_schedule_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class OauthTokenRefreshScheduleWorker
# only required in the sense that +perform+ must have an arity of 2. It is
# otherwise unused.
#
def perform(last_occurrence, current_occurrence)
def perform(_last_occurrence, current_occurrence)
lower_bound = Time.at(current_occurrence.floor)
upper_bound = Time.at(current_occurrence.ceil + 1) + 25.minutes

Expand Down
8 changes: 4 additions & 4 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
require 'rails'

%w(
active_record
action_controller
action_mailer
sprockets
active_record
action_controller
action_mailer
sprockets
).each do |framework|
begin
require "#{framework}/railtie"
Expand Down
2 changes: 1 addition & 1 deletion config/boot.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
2 changes: 1 addition & 1 deletion config/initializers/form_helper_errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# See http://stackoverflow.com/a/8380400/161787

ActionView::Base.field_error_proc = proc do |html_tag, instance|
ActionView::Base.field_error_proc = proc do |html_tag, _instance|
class_attr_index = html_tag.index 'class="'

if class_attr_index
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/paperclip.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Paperclip.interpolates(:compatible_id) do |attachment, style|
Paperclip.interpolates(:compatible_id) do |attachment, _style|
attachment.instance.legacy_id || attachment.instance.id
end

Expand Down
4 changes: 2 additions & 2 deletions config/unicorn/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
timeout 15
preload_app true

before_fork do |server, worker|
before_fork do |_server, _worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
Expand All @@ -15,7 +15,7 @@
Supermarket::CommunitySite.disconnect!
end

after_fork do |server, worker|
after_fork do |_server, _worker|
Signal.trap 'TERM' do
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
end
Expand Down
4 changes: 2 additions & 2 deletions config/unicorn/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

listen '/tmp/.supermarket.sock.0'

before_fork do |server, worker|
before_fork do |_server, _worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
Expand All @@ -17,7 +17,7 @@
Supermarket::CommunitySite.disconnect!
end

after_fork do |server, worker|
after_fork do |_server, _worker|
Signal.trap 'TERM' do
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
end
Expand Down
2 changes: 1 addition & 1 deletion lib/authorizer/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def initialize(user, record)
# @raise [RuntimeError]
# in development and test, when an undefined method is called
#
def method_missing(m, *args, &block)
def method_missing(m, *_args, &_block)
if Rails.env.development? || Rails.env.test?
raise "#{self.class.name} does not define #{m}!"
else
Expand Down
42 changes: 0 additions & 42 deletions rubocop-todo.yml

This file was deleted.

2 changes: 1 addition & 1 deletion spec/api/cookbook_create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
end

it 'returns the URI for the newly created cookbook' do
expect(json_body['uri']).to match(%r(api/v1/cookbooks/redis))
expect(json_body['uri']).to match(%r{api/v1/cookbooks/redis})
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/factories/account.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FactoryGirl.define do
factory :account do
association :user
association :user
uid { username }
sequence(:username) { |n| "johndoe#{n}" }
provider 'github'
provider 'github'
oauth_token { SecureRandom.hex(15) }
oauth_secret { SecureRandom.hex(20) }
oauth_expires { 10.days.from_now }
Expand Down
4 changes: 2 additions & 2 deletions spec/factories/ccla.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FactoryGirl.define do
factory :ccla do
head 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod'
body 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod'
head 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod'
body 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod'
version Supermarket::Config.ccla_version
end
end
24 changes: 12 additions & 12 deletions spec/factories/ccla_signature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
association :user
association :organization

prefix 'Mr.'
first_name 'John'
prefix 'Mr.'
first_name 'John'
middle_name 'A.'
last_name 'Doe'
suffix 'Sr.'
phone '1234567890'
email 'jdoe@example.com'
company 'Deer Corporation'
last_name 'Doe'
suffix 'Sr.'
phone '1234567890'
email 'jdoe@example.com'
company 'Deer Corporation'

address_line_1 '123 Some Street'
address_line_2 'Apartment #5'
city 'Pittsburgh'
state 'PA'
zip '15213'
country 'United States'
city 'Pittsburgh'
state 'PA'
zip '15213'
country 'United States'

agreement '1'
agreement '1'
end
end
2 changes: 1 addition & 1 deletion spec/factories/contributor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
factory :contributor do
association :organization
association :user
admin false
admin false
end
end
2 changes: 1 addition & 1 deletion spec/factories/email.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FactoryGirl.define do
factory :email do
association :user
association :user
email { "#{user.username}@example.com" }
confirmation_token 'ABCD1234'
confirmed_at { 1.day.ago }
Expand Down
4 changes: 2 additions & 2 deletions spec/factories/icla.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FactoryGirl.define do
factory :icla do
head 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod'
body 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod'
head 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod'
body 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod'
version Supermarket::Config.icla_version
end
end
24 changes: 12 additions & 12 deletions spec/factories/icla_signature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
factory :icla_signature do
association :user

prefix 'Mr.'
first_name 'John'
prefix 'Mr.'
first_name 'John'
middle_name 'A.'
last_name 'Doe'
suffix 'Sr.'
phone '1234567890'
email 'jdoe@example.com'
company 'Deer Corporation'
last_name 'Doe'
suffix 'Sr.'
phone '1234567890'
email 'jdoe@example.com'
company 'Deer Corporation'

address_line_1 '123 Some Street'
address_line_2 'Apartment #5'
city 'Pittsburgh'
state 'PA'
zip '15213'
country 'United States'
city 'Pittsburgh'
state 'PA'
zip '15213'
country 'United States'

agreement '1'
agreement '1'
end
end
4 changes: 2 additions & 2 deletions spec/factories/invitation.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FactoryGirl.define do
factory :invitation do
association :organization
token 'ABCD1234'
admin true
token 'ABCD1234'
admin true

sequence(:email) { |n| "johndoe#{n}@example.com" }
end
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/pull_request.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FactoryGirl.define do
factory :pull_request, class: Curry::PullRequest do
association :repository
number '1'
number '1'
end
end
4 changes: 2 additions & 2 deletions spec/factories/repository.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FactoryGirl.define do
factory :repository, class: Curry::Repository do
owner 'gofullstack'
name 'paprika'
owner 'gofullstack'
name 'paprika'
callback_url Supermarket::Config.pubsubhubbub['callback_url']
end
end
Loading