rubocop autofix

This commit is contained in:
2021-04-29 17:42:31 +02:00
parent b64fa26a55
commit f7799bb514
54 changed files with 127 additions and 50 deletions

View File

@@ -13,6 +13,7 @@ AllCops:
- 'config/initializers/*.rb' - 'config/initializers/*.rb'
- 'config/environments/*.rb' - 'config/environments/*.rb'
- 'config/*.rb' - 'config/*.rb'
- 'node_modules/**/*'
NewCops: enable NewCops: enable
Layout/LineLength: Layout/LineLength:

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module ApplicationCable module ApplicationCable
class Channel < ActionCable::Channel::Base class Channel < ActionCable::Channel::Base
end end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module ApplicationCable module ApplicationCable
class Connection < ActionCable::Connection::Base class Connection < ActionCable::Connection::Base
end end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
around_action :switch_locale around_action :switch_locale

View File

@@ -1,4 +1,5 @@
# frozen_string_literal: true
class HomeController < ApplicationController class HomeController < ApplicationController
def index def index; end
end
end end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class ProtectedController < ApplicationController class ProtectedController < ApplicationController
before_action :authenticate_user! before_action :authenticate_user!
include Pagy::Backend include Pagy::Backend

View File

@@ -3,7 +3,8 @@
# Controller: Callback # Controller: Callback
# #
# Description: Callback method for Bnet # Description: Callback method for Bnet
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController module Users
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
skip_before_action :verify_authenticity_token, only: :bnet skip_before_action :verify_authenticity_token, only: :bnet
def bnet def bnet
@@ -25,3 +26,4 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
redirect_to root_path redirect_to root_path
end end
end end
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowCharactersController < ProtectedController class WowCharactersController < ProtectedController
def index def index
@wow_characters = current_user.wow_characters.all @wow_characters = current_user.wow_characters.all

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowMountsController < ProtectedController class WowMountsController < ProtectedController
def index def index
@pagy, @wow_mounts = pagy(WowMount.all, items: 12) @pagy, @wow_mounts = pagy(WowMount.all, items: 12)

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowPetsController < ProtectedController class WowPetsController < ProtectedController
def index def index
@pagy, @wow_pets = pagy(WowPet.all, items: 12) @pagy, @wow_pets = pagy(WowPet.all, items: 12)

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module ApplicationHelper module ApplicationHelper
include Pagy::Frontend include Pagy::Frontend
end end

View File

@@ -1,2 +1,4 @@
# frozen_string_literal: true
module CharactersHelper module CharactersHelper
end end

View File

@@ -1,2 +1,4 @@
# frozen_string_literal: true
module HomeHelper module HomeHelper
end end

View File

@@ -1,2 +1,4 @@
# frozen_string_literal: true
module ProtectedHelper module ProtectedHelper
end end

View File

@@ -1,2 +1,4 @@
# frozen_string_literal: true
module WelcomeHelper module WelcomeHelper
end end

View File

@@ -1,2 +1,4 @@
# frozen_string_literal: true
module WowMountsHelper module WowMountsHelper
end end

View File

@@ -1,2 +1,4 @@
# frozen_string_literal: true
module WowPetsHelper module WowPetsHelper
end end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class ApplicationJob < ActiveJob::Base class ApplicationJob < ActiveJob::Base
# Automatically retry jobs that encountered a deadlock # Automatically retry jobs that encountered a deadlock
# retry_on ActiveRecord::Deadlocked # retry_on ActiveRecord::Deadlocked

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class ApplicationMailer < ActionMailer::Base class ApplicationMailer < ActionMailer::Base
default from: 'from@example.com' default from: 'from@example.com'
layout 'mailer' layout 'mailer'

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true self.abstract_class = true
end end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class LearnedWowPetAbility < ApplicationRecord class LearnedWowPetAbility < ApplicationRecord
belongs_to :wow_pet belongs_to :wow_pet
belongs_to :wow_pet_ability belongs_to :wow_pet_ability

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class UserObtainWowMount < ApplicationRecord class UserObtainWowMount < ApplicationRecord
belongs_to :user belongs_to :user
belongs_to :wow_mount belongs_to :wow_mount

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class UserObtainWowPet < ApplicationRecord class UserObtainWowPet < ApplicationRecord
belongs_to :user belongs_to :user
belongs_to :wow_pet belongs_to :wow_pet

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowCharacter < ApplicationRecord class WowCharacter < ApplicationRecord
extend Mobility extend Mobility
translates :translated_faction, :translated_gender translates :translated_faction, :translated_gender

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowCharacterMedium < ApplicationRecord class WowCharacterMedium < ApplicationRecord
belongs_to :wow_character belongs_to :wow_character
end end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowCharacterTitle < ApplicationRecord class WowCharacterTitle < ApplicationRecord
extend Mobility extend Mobility
translates :name, :male_name, :female_name translates :name, :male_name, :female_name

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowClass < ApplicationRecord class WowClass < ApplicationRecord
extend Mobility extend Mobility
translates :name, :power_type, :male_name, :female_name translates :name, :power_type, :male_name, :female_name

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowMount < ApplicationRecord class WowMount < ApplicationRecord
extend Mobility extend Mobility
translates :name, :description, :translated_faction, :translated_source translates :name, :description, :translated_faction, :translated_source

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowPet < ApplicationRecord class WowPet < ApplicationRecord
extend Mobility extend Mobility
translates :name, :translated_battle_pet_type, :description, :translated_source_type translates :name, :translated_battle_pet_type, :description, :translated_source_type

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowPetAbility < ApplicationRecord class WowPetAbility < ApplicationRecord
extend Mobility extend Mobility
translates :name, :translated_battle_pet_type translates :name, :translated_battle_pet_type

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowRace < ApplicationRecord class WowRace < ApplicationRecord
extend Mobility extend Mobility
translates :name, :translated_faction, :male_name, :female_name translates :name, :translated_faction, :male_name, :female_name

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowRealm < ApplicationRecord class WowRealm < ApplicationRecord
extend Mobility extend Mobility
translates :name, :category, :realm_type translates :name, :category, :realm_type

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowCharacterDetailWorker class WowCharacterDetailWorker
include Sidekiq::Worker include Sidekiq::Worker

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowCharacterMediaWorker class WowCharacterMediaWorker
include Sidekiq::Worker include Sidekiq::Worker

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowCharacterTitleDetailWorker class WowCharacterTitleDetailWorker
include Sidekiq::Worker include Sidekiq::Worker

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowCharacterTitlesWorker class WowCharacterTitlesWorker
include Sidekiq::Worker include Sidekiq::Worker

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowCharactersWorker class WowCharactersWorker
include Sidekiq::Worker include Sidekiq::Worker

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowClassDetailWorker class WowClassDetailWorker
include Sidekiq::Worker include Sidekiq::Worker

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowClassesWorker class WowClassesWorker
include Sidekiq::Worker include Sidekiq::Worker

View File

@@ -1,8 +1,6 @@
class WowMountDetailWorker < WowSidekiqWorker # frozen_string_literal: true
def locales
super
end
class WowMountDetailWorker < WowSidekiqWorker
def perform(mount_id) def perform(mount_id)
return unless (mount = WowMount.where(mount_id: mount_id).first) return unless (mount = WowMount.where(mount_id: mount_id).first)

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowMountsCollectionWorker class WowMountsCollectionWorker
include Sidekiq::Worker include Sidekiq::Worker

View File

@@ -1,8 +1,6 @@
class WowMountsWorker < WowSidekiqWorker # frozen_string_literal: true
def locales
super
end
class WowMountsWorker < WowSidekiqWorker
def perform def perform
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET']) RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
RBattlenet.set_options(locale: 'all') RBattlenet.set_options(locale: 'all')

View File

@@ -1,8 +1,6 @@
class WowPetAbilitiesWorker < WowSidekiqWorker # frozen_string_literal: true
def locales
super
end
class WowPetAbilitiesWorker < WowSidekiqWorker
def perform def perform
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET']) RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
RBattlenet.set_options(locale: 'all') RBattlenet.set_options(locale: 'all')

View File

@@ -1,10 +1,7 @@
# frozen_string_literal: true
class WowPetAbilityDetailWorker < WowSidekiqWorker class WowPetAbilityDetailWorker < WowSidekiqWorker
def locales
super
end
def perform(ability_id) def perform(ability_id)
return unless (ability = WowPetAbility.where(ability_id: ability_id).first) return unless (ability = WowPetAbility.where(ability_id: ability_id).first)
RBattlenet.set_options(locale: 'all') RBattlenet.set_options(locale: 'all')

View File

@@ -1,10 +1,7 @@
# frozen_string_literal: true
class WowPetDetailWorker < WowSidekiqWorker class WowPetDetailWorker < WowSidekiqWorker
def locales
super
end
def perform(pet_id) def perform(pet_id)
return unless (pet = WowPet.where(pet_id: pet_id).first) return unless (pet = WowPet.where(pet_id: pet_id).first)
RBattlenet.set_options(locale: 'all') RBattlenet.set_options(locale: 'all')
@@ -39,13 +36,11 @@ class WowPetDetailWorker < WowSidekiqWorker
creature_media = RBattlenet::Wow::CreatureMedia.find(pet.creature_display_id) creature_media = RBattlenet::Wow::CreatureMedia.find(pet.creature_display_id)
pet.media_zoom_url = creature_media.assets.first.value if creature_media.status_code == 200 pet.media_zoom_url = creature_media.assets.first.value if creature_media.status_code == 200
if result.abilities result.abilities&.each do |ability|
result.abilities.each do |ability|
next unless (local_ability = WowPetAbility.where(ability_id: ability.ability.id).first) next unless (local_ability = WowPetAbility.where(ability_id: ability.ability.id).first)
LearnedWowPetAbility.where(wow_pet: pet.id, wow_pet_ability: local_ability.id).first_or_create LearnedWowPetAbility.where(wow_pet: pet.id, wow_pet_ability: local_ability.id).first_or_create
end end
end
pet.save pet.save
end end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowPetsCollectionWorker class WowPetsCollectionWorker
include Sidekiq::Worker include Sidekiq::Worker

View File

@@ -1,8 +1,6 @@
class WowPetsWorker < WowSidekiqWorker # frozen_string_literal: true
def locales
super
end
class WowPetsWorker < WowSidekiqWorker
def perform def perform
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET']) RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
RBattlenet.set_options(locale: 'all') RBattlenet.set_options(locale: 'all')

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowRaceDetailWorker class WowRaceDetailWorker
include Sidekiq::Worker include Sidekiq::Worker

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowRacesWorker class WowRacesWorker
include Sidekiq::Worker include Sidekiq::Worker

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowRealmDetailWorker class WowRealmDetailWorker
include Sidekiq::Worker include Sidekiq::Worker

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowRealmsWorker class WowRealmsWorker
include Sidekiq::Worker include Sidekiq::Worker

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowSidekiqWorker class WowSidekiqWorker
include Sidekiq::Worker include Sidekiq::Worker

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
# This file is used by Rack-based servers to start the application. # This file is used by Rack-based servers to start the application.
require_relative 'config/environment' require_relative 'config/environment'

View File

@@ -1,3 +1,4 @@
# frozen_string_literal: true
# This file should contain all the record creation needed to seed the database with its default values. # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
# #