[RuboCop] Enable Style/FrozenStringLiteralComment

This reduces allocations on the posts page by about 5%, from basic testing
This commit is contained in:
Earlopain 2024-02-25 18:15:55 +01:00
parent bc06f8cea2
commit fc7d84affd
No known key found for this signature in database
GPG Key ID: 48860312319ADF61
564 changed files with 1201 additions and 94 deletions

View File

@ -118,9 +118,6 @@ Style/EmptyMethod:
Style/FloatDivision:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
Style/GuardClause:
Enabled: false

View File

@ -1,4 +1,6 @@
source 'https://rubygems.org/'
# frozen_string_literal: true
source "https://rubygems.org/"
gem "dotenv", require: "dotenv/load"

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 UserWarnable
extend ActiveSupport::Concern

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class DangerZoneController < ApplicationController
before_action :admin_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class DashboardsController < ApplicationController
before_action :admin_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class ExceptionsController < ApplicationController
before_action :admin_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class ReownerController < ApplicationController
before_action :is_bd_staff_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class StaffNotesController < ApplicationController
before_action :can_view_staff_notes_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class StuckDnpController < ApplicationController
before_action :admin_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin
class UsersController < ApplicationController
before_action :admin_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ApplicationController < ActionController::Base
class APIThrottled < Exception; end
class FeatureUnavailable < StandardError; end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ArtistUrlsController < ApplicationController
respond_to :json, :html
before_action :member_only, except: [:index]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ArtistVersionsController < ApplicationController
respond_to :html, :json

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ArtistsController < ApplicationController
respond_to :html, :json
before_action :member_only, :except => [:index, :show, :show_or_new]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class BansController < ApplicationController
before_action :moderator_only, :except => [:show, :index]
respond_to :html

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class BlipsController < ApplicationController
class BlipTooOld < Exception ; end
respond_to :html, :json

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class BulkUpdateRequestsController < ApplicationController
respond_to :html, :json
before_action :member_only, except: [:index, :show]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CommentVotesController < ApplicationController
respond_to :json
respond_to :html, only: [:index]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CommentsController < ApplicationController
respond_to :html, :json
before_action :member_only, except: %i[index search show for_post]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module DeferredPosts
extend ActiveSupport::Concern

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class DeletedPostsController < ApplicationController
respond_to :html

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class DmailsController < ApplicationController
respond_to :html
respond_to :json, except: %i[new create]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class DtextPreviewsController < ApplicationController
def create
body = params[:body] || ""

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditHistoriesController < ApplicationController
respond_to :html
before_action :moderator_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EmailBlacklistsController < ApplicationController
respond_to :html, :json, :js
before_action :admin_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EmailsController < ApplicationController
respond_to :html

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class FavoritesController < ApplicationController
before_action :member_only, except: [:index]
respond_to :html, :json

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ForumCategoriesController < ApplicationController
respond_to :html
before_action :admin_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ForumPostVotesController < ApplicationController
respond_to :json
before_action :member_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ForumPostsController < ApplicationController
respond_to :html, :json
before_action :member_only, :except => [:index, :show, :search]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ForumTopicsController < ApplicationController
respond_to :html, :json
before_action :member_only, :except => [:index, :show]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class HelpController < ApplicationController
respond_to :html, :json
helper :wiki_pages

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class IpBansController < ApplicationController
respond_to :html, :json
before_action :admin_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class IqdbQueriesController < ApplicationController
respond_to :html, :json
# Show uses POST because it needs a file parameter. This would be GET otherwise.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Maintenance
module User
class ApiKeysController < ApplicationController

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Maintenance
module User
class CountFixesController < ApplicationController

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Maintenance
module User
class DeletionsController < ApplicationController

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Maintenance
module User
class DmailFiltersController < ApplicationController

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Maintenance
module User
class EmailChangesController < ApplicationController

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Maintenance
module User
class EmailNotificationsController < ApplicationController

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Maintenance
module User
class LoginRemindersController < ApplicationController

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Maintenance
module User
class PasswordResetsController < ApplicationController

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Maintenance
module User
class PasswordsController < ApplicationController

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class MascotsController < ApplicationController
respond_to :html, :json
before_action :admin_only, except: [:index]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class MetaSearchesController < ApplicationController
def tags
@meta_search = MetaSearches::Tag.new(params)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ModActionsController < ApplicationController
respond_to :html, :json

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Moderator
class DashboardsController < ApplicationController
before_action :janitor_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Moderator
class IpAddrsController < ApplicationController
before_action :admin_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Moderator
module Post
class ApprovalsController < ApplicationController

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Moderator
module Post
class DisapprovalsController < ApplicationController

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Moderator
module Post
class PostsController < ApplicationController

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class NewsUpdatesController < ApplicationController
before_action :admin_only, except: [:index]
respond_to :html

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class NotePreviewsController < ApplicationController
respond_to :json

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class NoteVersionsController < ApplicationController
respond_to :html, :json

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class NotesController < ApplicationController
respond_to :html, :json, :js
before_action :member_only, :except => [:index, :show, :search]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PoolElementsController < ApplicationController
respond_to :html, :json, :js
before_action :member_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PoolOrdersController < ApplicationController
respond_to :html, :json, :js
before_action :member_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PoolVersionsController < ApplicationController
respond_to :html, :json
before_action :member_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PoolsController < ApplicationController
respond_to :html, :json
before_action :member_only, :except => [:index, :show, :gallery]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PopularController < ApplicationController
respond_to :html, :json

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PostApprovalsController < ApplicationController
respond_to :html, :json

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PostEventsController < ApplicationController
respond_to :html, :json

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PostFavoritesController < ApplicationController
respond_to :html

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PostFlagsController < ApplicationController
before_action :member_only, :except => [:index, :show]
before_action :janitor_only, only: [:destroy]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PostReplacementsController < ApplicationController
respond_to :html, :json
before_action :member_only, only: [:create, :new]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PostReportReasonsController < ApplicationController
respond_to :html
before_action :admin_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PostSetMaintainersController < ApplicationController
respond_to :html
respond_to :js, except: [:index]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PostSetsController < ApplicationController
respond_to :html, :json
before_action :member_only, except: [:index, :show]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PostVersionsController < ApplicationController
before_action :member_only, except: [:index]
respond_to :html, :json

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PostVotesController < ApplicationController
before_action :member_only
before_action :moderator_only, only: [:index, :lock]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PostsController < ApplicationController
before_action :member_only, except: %i[show show_seq index random]
before_action :admin_only, only: [:update_iqdb]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class RelatedTagsController < ApplicationController
respond_to :json, :html, only: [:show]
respond_to :json, only: [:bulk]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class SessionsController < ApplicationController
def new
@user = User.new

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class StaticController < ApplicationController
def privacy
@page = WikiPage.find_by(title: "e621:privacy_policy")

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class StatsController < ApplicationController
respond_to :html

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class TagAliasRequestsController < ApplicationController
before_action :member_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class TagAliasesController < ApplicationController
before_action :admin_only, except: [:index, :show, :destroy]
respond_to :html, :json, :js

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class TagCorrectionsController < ApplicationController
respond_to :html, :json
before_action :janitor_only, only: [:new, :create]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class TagImplicationRequestsController < ApplicationController
before_action :member_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class TagImplicationsController < ApplicationController
before_action :admin_only, except: [:index, :show, :destroy]
respond_to :html, :json, :js

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class TagTypeVersionsController < ApplicationController
respond_to :html, :json

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class TagsController < ApplicationController
before_action :member_only, :only => [:edit, :update, :preview]
respond_to :html, :json

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class TakedownsController < ApplicationController
respond_to :html, :json
before_action :can_handle_takedowns_only, only: %i[update edit destroy add_by_ids add_by_tags count_matching_posts remove_by_ids]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class TicketsController < ApplicationController
respond_to :html
before_action :member_only, except: [:index]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class UploadWhitelistsController < ApplicationController
respond_to :html, :json, :js
before_action :admin_only, only: [:new, :create, :edit, :update, :destroy]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class UploadsController < ApplicationController
before_action :member_only
before_action :janitor_only, only: [:index, :show]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class UserFeedbacksController < ApplicationController
before_action :moderator_only, :only => [:new, :edit, :create, :update, :destroy]
respond_to :html, :json

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class UserNameChangeRequestsController < ApplicationController
before_action :member_only, only: [:new, :create, :show]
before_action :moderator_only, only: :index

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class UserRevertsController < ApplicationController
before_action :moderator_only

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class UsersController < ApplicationController
respond_to :html, :json
skip_before_action :api_check

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class WikiPageVersionsController < ApplicationController
respond_to :html, :json

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class WikiPagesController < ApplicationController
respond_to :html, :json, :js
before_action :member_only, :except => [:index, :search, :show, :show_or_new]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ApplicationDecorator < Draper::Decorator
# NOTE: This is required for correct serialization of member models, otherwise hidden_attributes is ignored!!!
delegate :as_json, :serializable_hash

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ModActionDecorator < ApplicationDecorator
def self.collection_decorator_class
PaginatedDecorator

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PaginatedDecorator < Draper::CollectionDecorator
delegate :current_page, :total_pages, :is_first_page?, :is_last_page?, :pagination_mode, :max_numbered_pages, :records, :total_count
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PostEventDecorator < ApplicationDecorator
def self.collection_decorator_class
PaginatedDecorator

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PostsDecorator < ApplicationDecorator
def self.collection_decorator_class
PaginatedDecorator

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Admin::UsersHelper
def user_level_select(object, field)
options = Danbooru.config.levels.map { |x,y| [x,y] }

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ApplicationHelper
def disable_mobile_mode?
if CurrentUser.user.present? && CurrentUser.is_member?

Some files were not shown because too many files have changed in this diff Show More