diff --git a/.rubocop.yml b/.rubocop.yml index 8a921fd..960481c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,9 @@ inherit_gem: rubocop-rails-omakase: rubocop.yml +Style/FrozenStringLiteralComment: + Enabled: true + Style/TrailingCommaInArguments: EnforcedStyleForMultiline: consistent_comma diff --git a/Gemfile b/Gemfile index 0c5179c..d82c2cf 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source "https://rubygems.org" ruby file: "./.ruby-version" diff --git a/Rakefile b/Rakefile index 9a5ea73..d2a78aa 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +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. diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index d672697..9aec230 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ApplicationCable class Channel < ActionCable::Channel::Base end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 0ff5442..8d6c2a1 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ApplicationCable class Connection < ActionCable::Connection::Base end diff --git a/app/controllers/account_verifications_controller.rb b/app/controllers/account_verifications_controller.rb index 31f4dc3..ad556d5 100644 --- a/app/controllers/account_verifications_controller.rb +++ b/app/controllers/account_verifications_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AccountVerificationsController < ApplicationController skip_before_action :authenticate, only: [ :show ] diff --git a/app/controllers/admin/game_systems_controller.rb b/app/controllers/admin/game_systems_controller.rb index e689198..6e26b98 100644 --- a/app/controllers/admin/game_systems_controller.rb +++ b/app/controllers/admin/game_systems_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::GameSystemsController < AdminController before_action :set_game_system, only: [ :show, :edit, :update, :destroy ] def index diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 6cad70e..b476eef 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AdminController < ApplicationController layout "admin" diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ae34bf5..e33b27c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationController < ActionController::Base before_action :authenticate diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index a4f7b05..6aa95d5 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class SessionsController < ApplicationController skip_before_action :authenticate, only: [ :new, :create ] diff --git a/app/controllers/tables_controller.rb b/app/controllers/tables_controller.rb index 0c40dfd..a782914 100644 --- a/app/controllers/tables_controller.rb +++ b/app/controllers/tables_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class TablesController < ApplicationController def index end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 901280d..61f678f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class UsersController < ApplicationController skip_before_action :authenticate, only: [ :new, :create ] diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..15b06f0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + module ApplicationHelper end diff --git a/app/helpers/mailer_helper.rb b/app/helpers/mailer_helper.rb index 5f01347..90f9da8 100644 --- a/app/helpers/mailer_helper.rb +++ b/app/helpers/mailer_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MailerHelper def htmlify_email(content) content.gsub!("\n\n", "

\n\n

") diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb index 49ee652..13c176e 100644 --- a/app/helpers/sessions_helper.rb +++ b/app/helpers/sessions_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module SessionsHelper def logged_in? session[:user_id].present? diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index d394c3d..bef3959 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationJob < ActiveJob::Base # Automatically retry jobs that encountered a deadlock # retry_on ActiveRecord::Deadlocked diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 3c34c81..5cc63a0 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationMailer < ActionMailer::Base default from: "from@example.com" layout "mailer" diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index be9e82b..94d48f8 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class UserMailer < ApplicationMailer helper(:mailer) diff --git a/app/models/application_record.rb b/app/models/application_record.rb index b63caeb..08dc537 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationRecord < ActiveRecord::Base primary_abstract_class end diff --git a/app/models/current.rb b/app/models/current.rb index 73a9744..215b802 100644 --- a/app/models/current.rb +++ b/app/models/current.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Current < ActiveSupport::CurrentAttributes attribute :user end diff --git a/app/models/game_system.rb b/app/models/game_system.rb index 2852549..aa3a12a 100644 --- a/app/models/game_system.rb +++ b/app/models/game_system.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class GameSystem < ApplicationRecord validates :name, presence: true, uniqueness: true, diff --git a/app/models/site_role.rb b/app/models/site_role.rb index b396303..0e85a0b 100644 --- a/app/models/site_role.rb +++ b/app/models/site_role.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class SiteRole < ApplicationRecord validates :name, presence: true end diff --git a/app/models/user.rb b/app/models/user.rb index c8fe7c5..34a68f1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class User < ApplicationRecord has_and_belongs_to_many :site_roles diff --git a/config.ru b/config.ru index 4a3c09a..2e03084 100644 --- a/config.ru +++ b/config.ru @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file is used by Rack-based servers to start the application. require_relative "config/environment" diff --git a/config/application.rb b/config/application.rb index b989e9e..c047e5d 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative "boot" require "rails/all" diff --git a/config/boot.rb b/config/boot.rb index 988a5dd..aef6d03 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. diff --git a/config/environment.rb b/config/environment.rb index cac5315..7df99e8 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Load the Rails application. require_relative "application" diff --git a/config/environments/development.rb b/config/environments/development.rb index 0c881bf..af49d87 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "active_support/core_ext/integer/time" Rails.application.configure do diff --git a/config/environments/production.rb b/config/environments/production.rb index a6aa4eb..d649e77 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "active_support/core_ext/integer/time" Rails.application.configure do diff --git a/config/environments/test.rb b/config/environments/test.rb index b44b582..1287c8c 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "active_support/core_ext/integer/time" # The test environment is used exclusively to run your application's diff --git a/config/importmap.rb b/config/importmap.rb index 909dfc5..631a58a 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Pin npm packages by running ./bin/importmap pin "application" diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 2eeef96..101a290 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # 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. diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index b3076b3..35ab3fd 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Define an application-wide content security policy. diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 8fd698f..8876a0c 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # 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. diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 3860f65..9e049dc 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb index 7db3b95..e8d0b2a 100644 --- a/config/initializers/permissions_policy.rb +++ b/config/initializers/permissions_policy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Define an application-wide HTTP permissions policy. For further diff --git a/config/puma.rb b/config/puma.rb index afa809b..40efb18 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # 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 # about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html. diff --git a/config/routes.rb b/config/routes.rb index e28f5f1..bae428b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Rails.application.routes.draw do default_url_options host: "summonplayer.com" diff --git a/db/migrate/20240413152553_create_users.rb b/db/migrate/20240413152553_create_users.rb index e89502a..875e313 100644 --- a/db/migrate/20240413152553_create_users.rb +++ b/db/migrate/20240413152553_create_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateUsers < ActiveRecord::Migration[7.1] def change create_table :users do |t| diff --git a/db/migrate/20240414122652_add_verified_to_user.rb b/db/migrate/20240414122652_add_verified_to_user.rb index 9847d79..e5efe2d 100644 --- a/db/migrate/20240414122652_add_verified_to_user.rb +++ b/db/migrate/20240414122652_add_verified_to_user.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddVerifiedToUser < ActiveRecord::Migration[7.1] def change add_column :users, :verified, :boolean, null: false, default: false diff --git a/db/migrate/20240526084840_create_game_systems.rb b/db/migrate/20240526084840_create_game_systems.rb index 4388c09..faabc57 100644 --- a/db/migrate/20240526084840_create_game_systems.rb +++ b/db/migrate/20240526084840_create_game_systems.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateGameSystems < ActiveRecord::Migration[7.1] def change create_table :game_systems do |t| diff --git a/db/migrate/20240526085315_create_user_roles.rb b/db/migrate/20240526085315_create_user_roles.rb index fa1765a..4f0f611 100644 --- a/db/migrate/20240526085315_create_user_roles.rb +++ b/db/migrate/20240526085315_create_user_roles.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateUserRoles < ActiveRecord::Migration[7.1] def change create_table :site_roles do |t| diff --git a/db/migrate/20240526102908_add_unique_index_to_game_system_name.rb b/db/migrate/20240526102908_add_unique_index_to_game_system_name.rb index a86ad43..6b2f0fc 100644 --- a/db/migrate/20240526102908_add_unique_index_to_game_system_name.rb +++ b/db/migrate/20240526102908_add_unique_index_to_game_system_name.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddUniqueIndexToGameSystemName < ActiveRecord::Migration[7.1] def change add_index :game_systems, :name, unique: true diff --git a/db/seeds.rb b/db/seeds.rb index 4fbd6ed..0f16211 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -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, # 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). diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index 15fb146..d91e781 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "test_helper" class ApplicationSystemTestCase < ActionDispatch::SystemTestCase diff --git a/test/channels/application_cable/connection_test.rb b/test/channels/application_cable/connection_test.rb index 6340bf9..baa2e3f 100644 --- a/test/channels/application_cable/connection_test.rb +++ b/test/channels/application_cable/connection_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "test_helper" module ApplicationCable diff --git a/test/controllers/account_verifications_controller_test.rb b/test/controllers/account_verifications_controller_test.rb index 8176194..a448b19 100644 --- a/test/controllers/account_verifications_controller_test.rb +++ b/test/controllers/account_verifications_controller_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "test_helper" class AccountVerificationsControllerTest < ActionDispatch::IntegrationTest diff --git a/test/controllers/admin/game_systems_controller_test.rb b/test/controllers/admin/game_systems_controller_test.rb index e9c3ef7..62e31e3 100644 --- a/test/controllers/admin/game_systems_controller_test.rb +++ b/test/controllers/admin/game_systems_controller_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "test_helper" class AdminGameSystemsControllerTest < ActionDispatch::IntegrationTest diff --git a/test/controllers/admin_controller_test.rb b/test/controllers/admin_controller_test.rb index 04e8ce1..5f533ca 100644 --- a/test/controllers/admin_controller_test.rb +++ b/test/controllers/admin_controller_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "test_helper" class AdminControllerTest < ActionDispatch::IntegrationTest diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index 7486ae8..d86fa20 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "test_helper" class UsersControllerTest < ActionDispatch::IntegrationTest diff --git a/test/helpers/mailer_helper_test.rb b/test/helpers/mailer_helper_test.rb index ef65731..b68abab 100644 --- a/test/helpers/mailer_helper_test.rb +++ b/test/helpers/mailer_helper_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "test_helper" class MailerHelperTest < ActionView::TestCase diff --git a/test/integration/admin_game_systems_integration_test.rb b/test/integration/admin_game_systems_integration_test.rb index a0f7885..23ed0b7 100644 --- a/test/integration/admin_game_systems_integration_test.rb +++ b/test/integration/admin_game_systems_integration_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "test_helper" class AdminGameSystemsIntegrationTest < ActionDispatch::IntegrationTest diff --git a/test/integration/permissions_test.rb b/test/integration/permissions_test.rb index 16a9d04..3b60710 100644 --- a/test/integration/permissions_test.rb +++ b/test/integration/permissions_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "test_helper" class PermissionsTest < ActionDispatch::IntegrationTest diff --git a/test/mailers/previews/user_mailer_preview.rb b/test/mailers/previews/user_mailer_preview.rb index 51c962e..bc8ca5e 100644 --- a/test/mailers/previews/user_mailer_preview.rb +++ b/test/mailers/previews/user_mailer_preview.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Preview all emails at http://localhost:3000/rails/mailers/user_mailer class UserMailerPreview < ActionMailer::Preview def email_verification diff --git a/test/models/game_system_test.rb b/test/models/game_system_test.rb index 114514c..59267fa 100644 --- a/test/models/game_system_test.rb +++ b/test/models/game_system_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "test_helper" class GameSystemTest < ActiveSupport::TestCase diff --git a/test/models/site_role_test.rb b/test/models/site_role_test.rb index 4926586..bc2fd14 100644 --- a/test/models/site_role_test.rb +++ b/test/models/site_role_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "test_helper" class UserRoleTest < ActiveSupport::TestCase diff --git a/test/models/user_test.rb b/test/models/user_test.rb index ecee6ba..2f8b65f 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "test_helper" class UserTest < ActiveSupport::TestCase diff --git a/test/system/sessions_test.rb b/test/system/sessions_test.rb index 75bf285..89fa560 100644 --- a/test/system/sessions_test.rb +++ b/test/system/sessions_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "application_system_test_case" class SignUpsTest < ApplicationSystemTestCase diff --git a/test/system/sign_ups_test.rb b/test/system/sign_ups_test.rb index 25f4317..bd466f8 100644 --- a/test/system/sign_ups_test.rb +++ b/test/system/sign_ups_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "application_system_test_case" class SignUpsTest < ApplicationSystemTestCase diff --git a/test/test_helper.rb b/test/test_helper.rb index 9f81546..6751aa3 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ENV["RAILS_ENV"] ||= "test" require_relative "../config/environment" require "rails/test_help"