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:
rubocop-rails-omakase: rubocop.yml
Style/FrozenStringLiteralComment:
Enabled: true
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: consistent_comma

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
source "https://rubygems.org"
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,
# 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
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 AccountVerificationsController < ApplicationController
skip_before_action :authenticate, only: [ :show ]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class User < ApplicationRecord
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.
require_relative "config/environment"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require_relative "boot"
require "rails/all"

View File

@ -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.

View File

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

View File

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

View File

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

View File

@ -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

View File

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

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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.

View File

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

View File

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

View File

@ -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

View File

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

View File

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

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddUniqueIndexToGameSystemName < ActiveRecord::Migration[7.1]
def change
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,
# 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).

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "test_helper"
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
class UserMailerPreview < ActionMailer::Preview
def email_verification

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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