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/environments/*.rb'
- 'config/*.rb'
- 'node_modules/**/*'
NewCops: enable
Layout/LineLength:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,10 +1,7 @@
# frozen_string_literal: true
class WowPetDetailWorker < WowSidekiqWorker
def locales
super
end
def perform(pet_id)
return unless (pet = WowPet.where(pet_id: pet_id).first)
RBattlenet.set_options(locale: 'all')
@@ -39,13 +36,11 @@ class WowPetDetailWorker < WowSidekiqWorker
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
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)
LearnedWowPetAbility.where(wow_pet: pet.id, wow_pet_ability: local_ability.id).first_or_create
end
end
pet.save
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class WowSidekiqWorker
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.
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.
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
#