forked from e621ng/e621ng
[RuboCop] Enable Style/FrozenStringLiteralComment
This reduces allocations on the posts page by about 5%, from basic testing
This commit is contained in:
parent
bc06f8cea2
commit
fc7d84affd
@ -118,9 +118,6 @@ Style/EmptyMethod:
|
||||
Style/FloatDivision:
|
||||
Enabled: false
|
||||
|
||||
Style/FrozenStringLiteralComment:
|
||||
Enabled: false
|
||||
|
||||
Style/GuardClause:
|
||||
Enabled: false
|
||||
|
||||
|
4
Gemfile
4
Gemfile
@ -1,4 +1,6 @@
|
||||
source 'https://rubygems.org/'
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org/"
|
||||
|
||||
gem "dotenv", require: "dotenv/load"
|
||||
|
||||
|
2
Rakefile
2
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.
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module UserWarnable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class DangerZoneController < ApplicationController
|
||||
before_action :admin_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class DashboardsController < ApplicationController
|
||||
before_action :admin_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class ExceptionsController < ApplicationController
|
||||
before_action :admin_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class ReownerController < ApplicationController
|
||||
before_action :is_bd_staff_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class StaffNotesController < ApplicationController
|
||||
before_action :can_view_staff_notes_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class StuckDnpController < ApplicationController
|
||||
before_action :admin_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class UsersController < ApplicationController
|
||||
before_action :admin_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
class APIThrottled < Exception; end
|
||||
class FeatureUnavailable < StandardError; end
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ArtistUrlsController < ApplicationController
|
||||
respond_to :json, :html
|
||||
before_action :member_only, except: [:index]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ArtistVersionsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
|
||||
|
@ -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]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class BansController < ApplicationController
|
||||
before_action :moderator_only, :except => [:show, :index]
|
||||
respond_to :html
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class BlipsController < ApplicationController
|
||||
class BlipTooOld < Exception ; end
|
||||
respond_to :html, :json
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class BulkUpdateRequestsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
before_action :member_only, except: [:index, :show]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CommentVotesController < ApplicationController
|
||||
respond_to :json
|
||||
respond_to :html, only: [:index]
|
||||
|
@ -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]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module DeferredPosts
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class DeletedPostsController < ApplicationController
|
||||
respond_to :html
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class DmailsController < ApplicationController
|
||||
respond_to :html
|
||||
respond_to :json, except: %i[new create]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class DtextPreviewsController < ApplicationController
|
||||
def create
|
||||
body = params[:body] || ""
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class EditHistoriesController < ApplicationController
|
||||
respond_to :html
|
||||
before_action :moderator_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class EmailBlacklistsController < ApplicationController
|
||||
respond_to :html, :json, :js
|
||||
before_action :admin_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class EmailsController < ApplicationController
|
||||
respond_to :html
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class FavoritesController < ApplicationController
|
||||
before_action :member_only, except: [:index]
|
||||
respond_to :html, :json
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ForumCategoriesController < ApplicationController
|
||||
respond_to :html
|
||||
before_action :admin_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ForumPostVotesController < ApplicationController
|
||||
respond_to :json
|
||||
before_action :member_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ForumPostsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
before_action :member_only, :except => [:index, :show, :search]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ForumTopicsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
before_action :member_only, :except => [:index, :show]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class HelpController < ApplicationController
|
||||
respond_to :html, :json
|
||||
helper :wiki_pages
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class IpBansController < ApplicationController
|
||||
respond_to :html, :json
|
||||
before_action :admin_only
|
||||
|
@ -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.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Maintenance
|
||||
module User
|
||||
class ApiKeysController < ApplicationController
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Maintenance
|
||||
module User
|
||||
class CountFixesController < ApplicationController
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Maintenance
|
||||
module User
|
||||
class DeletionsController < ApplicationController
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Maintenance
|
||||
module User
|
||||
class DmailFiltersController < ApplicationController
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Maintenance
|
||||
module User
|
||||
class EmailChangesController < ApplicationController
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Maintenance
|
||||
module User
|
||||
class EmailNotificationsController < ApplicationController
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Maintenance
|
||||
module User
|
||||
class LoginRemindersController < ApplicationController
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Maintenance
|
||||
module User
|
||||
class PasswordResetsController < ApplicationController
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Maintenance
|
||||
module User
|
||||
class PasswordsController < ApplicationController
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MascotsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
before_action :admin_only, except: [:index]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MetaSearchesController < ApplicationController
|
||||
def tags
|
||||
@meta_search = MetaSearches::Tag.new(params)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ModActionsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Moderator
|
||||
class DashboardsController < ApplicationController
|
||||
before_action :janitor_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Moderator
|
||||
class IpAddrsController < ApplicationController
|
||||
before_action :admin_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Moderator
|
||||
module Post
|
||||
class ApprovalsController < ApplicationController
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Moderator
|
||||
module Post
|
||||
class DisapprovalsController < ApplicationController
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Moderator
|
||||
module Post
|
||||
class PostsController < ApplicationController
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class NewsUpdatesController < ApplicationController
|
||||
before_action :admin_only, except: [:index]
|
||||
respond_to :html
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class NotePreviewsController < ApplicationController
|
||||
respond_to :json
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class NoteVersionsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class NotesController < ApplicationController
|
||||
respond_to :html, :json, :js
|
||||
before_action :member_only, :except => [:index, :show, :search]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PoolElementsController < ApplicationController
|
||||
respond_to :html, :json, :js
|
||||
before_action :member_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PoolOrdersController < ApplicationController
|
||||
respond_to :html, :json, :js
|
||||
before_action :member_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PoolVersionsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
before_action :member_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PoolsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
before_action :member_only, :except => [:index, :show, :gallery]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PopularController < ApplicationController
|
||||
respond_to :html, :json
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PostApprovalsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PostEventsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PostFavoritesController < ApplicationController
|
||||
respond_to :html
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PostFlagsController < ApplicationController
|
||||
before_action :member_only, :except => [:index, :show]
|
||||
before_action :janitor_only, only: [:destroy]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PostReplacementsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
before_action :member_only, only: [:create, :new]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PostReportReasonsController < ApplicationController
|
||||
respond_to :html
|
||||
before_action :admin_only
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PostSetMaintainersController < ApplicationController
|
||||
respond_to :html
|
||||
respond_to :js, except: [:index]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PostSetsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
before_action :member_only, except: [:index, :show]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PostVersionsController < ApplicationController
|
||||
before_action :member_only, except: [:index]
|
||||
respond_to :html, :json
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PostVotesController < ApplicationController
|
||||
before_action :member_only
|
||||
before_action :moderator_only, only: [:index, :lock]
|
||||
|
@ -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]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RelatedTagsController < ApplicationController
|
||||
respond_to :json, :html, only: [:show]
|
||||
respond_to :json, only: [:bulk]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class SessionsController < ApplicationController
|
||||
def new
|
||||
@user = User.new
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class StaticController < ApplicationController
|
||||
def privacy
|
||||
@page = WikiPage.find_by(title: "e621:privacy_policy")
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class StatsController < ApplicationController
|
||||
respond_to :html
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class TagAliasRequestsController < ApplicationController
|
||||
before_action :member_only
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class TagAliasesController < ApplicationController
|
||||
before_action :admin_only, except: [:index, :show, :destroy]
|
||||
respond_to :html, :json, :js
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class TagCorrectionsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
before_action :janitor_only, only: [:new, :create]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class TagImplicationRequestsController < ApplicationController
|
||||
before_action :member_only
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class TagImplicationsController < ApplicationController
|
||||
before_action :admin_only, except: [:index, :show, :destroy]
|
||||
respond_to :html, :json, :js
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class TagTypeVersionsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class TagsController < ApplicationController
|
||||
before_action :member_only, :only => [:edit, :update, :preview]
|
||||
respond_to :html, :json
|
||||
|
@ -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]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class TicketsController < ApplicationController
|
||||
respond_to :html
|
||||
before_action :member_only, except: [:index]
|
||||
|
@ -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]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UploadsController < ApplicationController
|
||||
before_action :member_only
|
||||
before_action :janitor_only, only: [:index, :show]
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UserRevertsController < ApplicationController
|
||||
before_action :moderator_only
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UsersController < ApplicationController
|
||||
respond_to :html, :json
|
||||
skip_before_action :api_check
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WikiPageVersionsController < ApplicationController
|
||||
respond_to :html, :json
|
||||
|
||||
|
@ -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]
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ModActionDecorator < ApplicationDecorator
|
||||
def self.collection_decorator_class
|
||||
PaginatedDecorator
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PostEventDecorator < ApplicationDecorator
|
||||
def self.collection_decorator_class
|
||||
PaginatedDecorator
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PostsDecorator < ApplicationDecorator
|
||||
def self.collection_decorator_class
|
||||
PaginatedDecorator
|
||||
|
@ -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] }
|
||||
|
@ -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
Loading…
Reference in New Issue
Block a user