Enable frozen_string_literal cop

This commit is contained in:
Trevor Vallender 2024-05-26 11:45:10 +01:00
parent 93359a5b59
commit fa802b81c5
60 changed files with 121 additions and 0 deletions

View File

@ -1,6 +1,9 @@
inherit_gem: inherit_gem:
rubocop-rails-omakase: rubocop.yml rubocop-rails-omakase: rubocop.yml
Style/FrozenStringLiteralComment:
Enabled: true
Style/TrailingCommaInArguments: Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: consistent_comma EnforcedStyleForMultiline: consistent_comma

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
source "https://rubygems.org" source "https://rubygems.org"
ruby file: "./.ruby-version" ruby file: "./.ruby-version"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Add your own tasks in files placed in lib/tasks ending in .rake, # 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. # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

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 AccountVerificationsController < ApplicationController class AccountVerificationsController < ApplicationController
skip_before_action :authenticate, only: [ :show ] skip_before_action :authenticate, only: [ :show ]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Admin::GameSystemsController < AdminController class Admin::GameSystemsController < AdminController
before_action :set_game_system, only: [ :show, :edit, :update, :destroy ] before_action :set_game_system, only: [ :show, :edit, :update, :destroy ]
def index def index

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AdminController < ApplicationController class AdminController < ApplicationController
layout "admin" layout "admin"

View File

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

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class SessionsController < ApplicationController class SessionsController < ApplicationController
skip_before_action :authenticate, only: [ :new, :create ] skip_before_action :authenticate, only: [ :new, :create ]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class TablesController < ApplicationController class TablesController < ApplicationController
def index def index
end end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class UsersController < ApplicationController class UsersController < ApplicationController
skip_before_action :authenticate, only: [ :new, :create ] skip_before_action :authenticate, only: [ :new, :create ]

View File

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

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module MailerHelper module MailerHelper
def htmlify_email(content) def htmlify_email(content)
content.gsub!("\n\n", "</p>\n\n<p>") content.gsub!("\n\n", "</p>\n\n<p>")

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module SessionsHelper module SessionsHelper
def logged_in? def logged_in?
session[:user_id].present? session[:user_id].present?

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 UserMailer < ApplicationMailer class UserMailer < ApplicationMailer
helper(:mailer) helper(:mailer)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base class ApplicationRecord < ActiveRecord::Base
primary_abstract_class primary_abstract_class
end end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Current < ActiveSupport::CurrentAttributes class Current < ActiveSupport::CurrentAttributes
attribute :user attribute :user
end end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class GameSystem < ApplicationRecord class GameSystem < ApplicationRecord
validates :name, presence: true, validates :name, presence: true,
uniqueness: true, uniqueness: true,

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class SiteRole < ApplicationRecord class SiteRole < ApplicationRecord
validates :name, presence: true validates :name, presence: true
end end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class User < ApplicationRecord class User < ApplicationRecord
has_and_belongs_to_many :site_roles has_and_belongs_to_many :site_roles

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,5 @@
# frozen_string_literal: true
require_relative "boot" require_relative "boot"
require "rails/all" require "rails/all"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile. require "bundler/setup" # Set up gems listed in the Gemfile.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Load the Rails application. # Load the Rails application.
require_relative "application" require_relative "application"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "active_support/core_ext/integer/time" require "active_support/core_ext/integer/time"
Rails.application.configure do Rails.application.configure do

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "active_support/core_ext/integer/time" require "active_support/core_ext/integer/time"
Rails.application.configure do Rails.application.configure do

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "active_support/core_ext/integer/time" require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's # The test environment is used exclusively to run your application's

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Pin npm packages by running ./bin/importmap # Pin npm packages by running ./bin/importmap
pin "application" pin "application"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets. # Version of your assets, change this if you want to expire all your assets.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy. # Define an application-wide content security policy.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections # Add new inflection rules using the following format. Inflections

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Define an application-wide HTTP permissions policy. For further # Define an application-wide HTTP permissions policy. For further

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# This configuration file will be evaluated by Puma. The top-level methods that # This configuration file will be evaluated by Puma. The top-level methods that
# are invoked here are part of Puma's configuration DSL. For more information # are invoked here are part of Puma's configuration DSL. For more information
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html. # about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
Rails.application.routes.draw do Rails.application.routes.draw do
default_url_options host: "summonplayer.com" default_url_options host: "summonplayer.com"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateUsers < ActiveRecord::Migration[7.1] class CreateUsers < ActiveRecord::Migration[7.1]
def change def change
create_table :users do |t| create_table :users do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddVerifiedToUser < ActiveRecord::Migration[7.1] class AddVerifiedToUser < ActiveRecord::Migration[7.1]
def change def change
add_column :users, :verified, :boolean, null: false, default: false add_column :users, :verified, :boolean, null: false, default: false

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateGameSystems < ActiveRecord::Migration[7.1] class CreateGameSystems < ActiveRecord::Migration[7.1]
def change def change
create_table :game_systems do |t| create_table :game_systems do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateUserRoles < ActiveRecord::Migration[7.1] class CreateUserRoles < ActiveRecord::Migration[7.1]
def change def change
create_table :site_roles do |t| create_table :site_roles do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddUniqueIndexToGameSystemName < ActiveRecord::Migration[7.1] class AddUniqueIndexToGameSystemName < ActiveRecord::Migration[7.1]
def change def change
add_index :game_systems, :name, unique: true add_index :game_systems, :name, unique: true

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# This file should ensure the existence of records required to run the application in every environment (production, # This file should ensure the existence of records required to run the application in every environment (production,
# development, test). The code here should be idempotent so that it can be executed at any point in every environment. # development, test). The code here should be idempotent so that it can be executed at any point in every environment.
# 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).

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper" require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase class ApplicationSystemTestCase < ActionDispatch::SystemTestCase

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper" require "test_helper"
module ApplicationCable module ApplicationCable

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper" require "test_helper"
class AccountVerificationsControllerTest < ActionDispatch::IntegrationTest class AccountVerificationsControllerTest < ActionDispatch::IntegrationTest

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper" require "test_helper"
class AdminGameSystemsControllerTest < ActionDispatch::IntegrationTest class AdminGameSystemsControllerTest < ActionDispatch::IntegrationTest

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper" require "test_helper"
class AdminControllerTest < ActionDispatch::IntegrationTest class AdminControllerTest < ActionDispatch::IntegrationTest

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper" require "test_helper"
class UsersControllerTest < ActionDispatch::IntegrationTest class UsersControllerTest < ActionDispatch::IntegrationTest

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper" require "test_helper"
class MailerHelperTest < ActionView::TestCase class MailerHelperTest < ActionView::TestCase

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper" require "test_helper"
class AdminGameSystemsIntegrationTest < ActionDispatch::IntegrationTest class AdminGameSystemsIntegrationTest < ActionDispatch::IntegrationTest

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper" require "test_helper"
class PermissionsTest < ActionDispatch::IntegrationTest class PermissionsTest < ActionDispatch::IntegrationTest

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Preview all emails at http://localhost:3000/rails/mailers/user_mailer # Preview all emails at http://localhost:3000/rails/mailers/user_mailer
class UserMailerPreview < ActionMailer::Preview class UserMailerPreview < ActionMailer::Preview
def email_verification def email_verification

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper" require "test_helper"
class GameSystemTest < ActiveSupport::TestCase class GameSystemTest < ActiveSupport::TestCase

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper" require "test_helper"
class UserRoleTest < ActiveSupport::TestCase class UserRoleTest < ActiveSupport::TestCase

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper" require "test_helper"
class UserTest < ActiveSupport::TestCase class UserTest < ActiveSupport::TestCase

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "application_system_test_case" require "application_system_test_case"
class SignUpsTest < ApplicationSystemTestCase class SignUpsTest < ApplicationSystemTestCase

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "application_system_test_case" require "application_system_test_case"
class SignUpsTest < ApplicationSystemTestCase class SignUpsTest < ApplicationSystemTestCase

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
ENV["RAILS_ENV"] ||= "test" ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment" require_relative "../config/environment"
require "rails/test_help" require "rails/test_help"