Skip to content

Commit

Permalink
rubocop auto correct
Browse files Browse the repository at this point in the history
  • Loading branch information
8398a7 committed Mar 28, 2017
1 parent a599e2b commit 99db2f9
Show file tree
Hide file tree
Showing 133 changed files with 158 additions and 17 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ ClassAndModuleChildren:
Documentation:
Enabled: false

Style/MixinGrouping:
Enabled: false

# has_ から始まるメソッドは許可する
Style/PredicateName:
NamePrefixBlacklist:
Expand All @@ -26,6 +29,7 @@ AllCops:
- '**/Rakefile'
- '**/config.ru'
Exclude:
- 'Gemfile'
- 'db/**/*'
- 'bin/*'
- 'config/**/*'
Expand Down
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# frozen_string_literal: true

source 'https://rubygems.org'
ruby '2.4.0'

# a,b,c,d,e,f,g {{{
gem 'activerecord-import'
gem 'aws-sdk'
gem 'assets_rails'
gem 'aws-sdk'
gem 'capistrano-slackify', require: false
gem 'carrierwave'
gem 'coffee-rails'
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

Expand Down
1 change: 1 addition & 0 deletions app/controllers/admin/dashboards_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class Admin::DashboardsController < ApplicationController
before_action :authenticate_user!
before_action :owner_user!
Expand Down
1 change: 1 addition & 0 deletions app/controllers/admin/mails_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class Admin::MailsController < ApplicationController
before_action :authenticate_user!
before_action :admin_user!
Expand Down
1 change: 1 addition & 0 deletions app/controllers/admin/messages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class Admin::MessagesController < ApplicationController
before_action :authenticate_user!
before_action :admin_user!
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/admin/sheets_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# frozen_string_literal: true

class Admin::SheetsController < ApplicationController
before_action :authenticate_user!
before_action :member_user!
before_action :load_sheet, except: [:index, :new, :create]
before_action :load_sheet, except: %i(index new create)

def index
@search = Sheet.search(params[:q])
Expand Down
1 change: 1 addition & 0 deletions app/controllers/admin/sidekiq_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class Admin::SidekiqController < ApplicationController
before_action :authenticate_user!
before_action :admin_user!
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# frozen_string_literal: true

class Admin::UsersController < ApplicationController
before_action :authenticate_user!
before_action :admin_user!
before_action :check_xhr, except: [:index, :login]
before_action :load_user, except: [:index, :new, :create]
before_action :check_xhr, except: %i(index login)
before_action :load_user, except: %i(index new create)

def index
@search = User.search(params[:q])
Expand Down
1 change: 1 addition & 0 deletions app/controllers/api/api_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class UnauthorizedError < RuntimeError; end
class Forbidden < RuntimeError; end
class BadRequest < RuntimeError; end
Expand Down
1 change: 1 addition & 0 deletions app/controllers/api/v1/base_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true

class Api::V1::BaseController < Api::ApiController
end
1 change: 1 addition & 0 deletions app/controllers/api/v1/logs_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class Api::V1::LogsController < Api::V1::BaseController
before_action :load_user!

Expand Down
1 change: 1 addition & 0 deletions app/controllers/api/v1/messages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class Api::V1::MessagesController < Api::V1::BaseController
def index
authenticate_member!
Expand Down
1 change: 1 addition & 0 deletions app/controllers/api/v1/scores_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class Api::V1::ScoresController < Api::V1::BaseController
before_action :load_user, except: :sync_official
before_action :authenticate!, only: :update
Expand Down
1 change: 1 addition & 0 deletions app/controllers/api/v1/sheets_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class Api::V1::SheetsController < Api::V1::BaseController
def index
sheets = {}
Expand Down
1 change: 1 addition & 0 deletions app/controllers/api/v1/statics_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class Api::V1::StaticsController < Api::V1::BaseController
def index
render json: {
Expand Down
1 change: 1 addition & 0 deletions app/controllers/api/v1/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class Api::V1::UsersController < Api::V1::BaseController
before_action :authenticate!, only: %i(change_rival score_viewer)

Expand Down
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class ApplicationController < ActionController::Base
before_action :set_raven_context
# protect_from_forgery with: :exception
Expand Down
1 change: 1 addition & 0 deletions app/controllers/helps_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class HelpsController < ApplicationController
def official
domain = Rails.env.development? ? request.host_with_port : request.host
Expand Down
1 change: 1 addition & 0 deletions app/controllers/logs_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class LogsController < ApplicationController
before_action :special_user!, only: %w(update_official)
before_action :load_user, only: %w(sheet list show)
Expand Down
1 change: 1 addition & 0 deletions app/controllers/messages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class MessagesController < ApplicationController
def new
@message = Message.new
Expand Down
1 change: 1 addition & 0 deletions app/controllers/recommends_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class RecommendsController < ApplicationController
before_action :load_color
before_action :load_sheets
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/rivals_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# frozen_string_literal: true

class RivalsController < ApplicationController
before_action :authenticate_user!
before_action :load_sheet, only: [:clear, :hard]
before_action :load_sheet, only: %i(clear hard)

def list
@users = current_user.following
Expand Down
1 change: 1 addition & 0 deletions app/controllers/scores_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class ScoresController < ApplicationController
before_action :authenticate_user!
before_action :check_xhr
Expand Down
1 change: 1 addition & 0 deletions app/controllers/sheets_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class SheetsController < ApplicationController
before_action :load_user
before_action :check_action, except: %i(change_reverse detail)
Expand Down
1 change: 1 addition & 0 deletions app/controllers/users/passwords_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class Users::PasswordsController < Devise::PasswordsController
def create
self.resource = resource_class.send_reset_password_instructions(resource_params)
Expand Down
1 change: 1 addition & 0 deletions app/controllers/users/registrations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class Users::RegistrationsController < Devise::RegistrationsController
def create
pre_user = User.select(:id).count
Expand Down
1 change: 1 addition & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class UsersController < ApplicationController
def index
@title = '最近更新した200人'
Expand Down
1 change: 1 addition & 0 deletions app/controllers/welcomes_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class WelcomesController < ApplicationController
def index
@title = 'TOP'
Expand Down
1 change: 1 addition & 0 deletions app/decorators/mail_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class MailDecorator < Draper::Decorator
delegate_all
end
1 change: 1 addition & 0 deletions app/decorators/message_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class MessageDecorator < Draper::Decorator
delegate_all

Expand Down
1 change: 1 addition & 0 deletions app/decorators/score_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class ScoreDecorator < Draper::Decorator
delegate_all

Expand Down
1 change: 1 addition & 0 deletions app/decorators/sheet_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class SheetDecorator < Draper::Decorator
delegate_all

Expand Down
1 change: 1 addition & 0 deletions app/decorators/user_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class UserDecorator < Draper::Decorator
delegate_all

Expand Down
1 change: 1 addition & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module ApplicationHelper
def return_ability_rival(cnt)
params[:action] == 'clear' ? @sheets[cnt].n_ability : @sheets[cnt].h_ability
Expand Down
1 change: 1 addition & 0 deletions app/mailers/devise/mailer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class Devise::Mailer < Devise.parent_mailer.constantize
include Devise::Mailers::Helpers

Expand Down
1 change: 1 addition & 0 deletions app/mailers/notice_mail.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class NoticeMail < ActionMailer::Base
default from: 'no-reply@iidx12.tk'

Expand Down
1 change: 1 addition & 0 deletions app/models/ability.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# == Schema Information
#
# Table name: abilities
Expand Down
1 change: 1 addition & 0 deletions app/models/application_record.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
1 change: 1 addition & 0 deletions app/models/concerns/graph.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Graph
extend ActiveSupport::Concern

Expand Down
1 change: 1 addition & 0 deletions app/models/concerns/score/api.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Score::API
extend ActiveSupport::Concern

Expand Down
1 change: 1 addition & 0 deletions app/models/concerns/score/iidxme.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Score::IIDXME
extend ActiveSupport::Concern

Expand Down
1 change: 1 addition & 0 deletions app/models/concerns/score/score_viewer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Score::ScoreViewer
extend ActiveSupport::Concern

Expand Down
1 change: 1 addition & 0 deletions app/models/concerns/sheet/api.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Sheet::API
extend ActiveSupport::Concern

Expand Down
1 change: 1 addition & 0 deletions app/models/concerns/static.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Static
LAMP = %w(FC EXH H C E A F N).freeze
LAMP_HASH = LAMP.map.with_index(0) { |e, i| [e, i] }.to_h
Expand Down
1 change: 1 addition & 0 deletions app/models/concerns/user/api.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module User::API
extend ActiveSupport::Concern

Expand Down
1 change: 1 addition & 0 deletions app/models/concerns/user/devise_methods.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module User::DeviseMethods
extend ActiveSupport::Concern

Expand Down
1 change: 1 addition & 0 deletions app/models/concerns/user/follow_methods.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module User::FollowMethods
extend ActiveSupport::Concern
included do
Expand Down
21 changes: 11 additions & 10 deletions app/models/concerns/user/list.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module User::List
extend ActiveSupport::Concern

Expand All @@ -9,16 +10,16 @@ def users_list(type, options = {})
end

def recent200
query = <<-EOF
SELECT
users.id, users.djname, users.iidxid, users.pref, users.grade,
scores.updated_at, scores.state, sheets.title
FROM users, scores, sheets
WHERE users.id = scores.user_id
AND scores.state != 7
AND sheets.id = scores.sheet_id
ORDER BY scores.updated_at DESC
LIMIT 6400
query = <<~EOF
SELECT
users.id, users.djname, users.iidxid, users.pref, users.grade,
scores.updated_at, scores.state, sheets.title
FROM users, scores, sheets
WHERE users.id = scores.user_id
AND scores.state != 7
AND sheets.id = scores.sheet_id
ORDER BY scores.updated_at DESC
LIMIT 6400
EOF
query.chomp.tr("\n", ' ')
users = ActiveRecord::Base.connection.execute(query.chomp.tr("\n", ' ')).to_a
Expand Down
1 change: 1 addition & 0 deletions app/models/concerns/user/official.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module User::Official
extend ActiveSupport::Concern

Expand Down
1 change: 1 addition & 0 deletions app/models/concerns/user/role.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module User::Role
extend ActiveSupport::Concern

Expand Down
1 change: 1 addition & 0 deletions app/models/concerns/user/static.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module User::Static
PREF = %w(
海外
Expand Down
1 change: 1 addition & 0 deletions app/models/follow.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# == Schema Information
#
# Table name: follows
Expand Down
1 change: 1 addition & 0 deletions app/models/log.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# == Schema Information
#
# Table name: logs
Expand Down
1 change: 1 addition & 0 deletions app/models/message.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# == Schema Information
#
# Table name: messages
Expand Down
Loading

0 comments on commit 99db2f9

Please sign in to comment.