Enable frozen string literals.

Make all string literals immutable by default.
This commit is contained in:
evazion
2021-12-14 19:29:23 -06:00
parent 67b96135dd
commit a7dc05ce63
392 changed files with 786 additions and 2 deletions

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module ApplicationHelper
def listing_type(*fields, member_check: true, types: [:revert, :standard])
(fields.reduce(false) { |acc, field| acc || params.dig(:search, field).present? } && (!member_check || CurrentUser.is_member?) ? types[0] : types[1])

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module ArtistCommentariesHelper
def format_commentary_title(title, classes: "")
tag.h3 do

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module ArtistCommentaryVersionsHelper
def commentary_version_field_diff(commentary_version, type, field)
other = commentary_version.send(params[:type])

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module ArtistVersionsHelper
def artist_version_other_names_diff(artist_version, type)
other = artist_version.send(type)

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module ComponentsHelper
def post_preview(post, fit: :fixed, **options)
render PostPreviewComponent.new(post: post, fit: fit, **options)

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module DelayedJobsHelper
def print_name(job)
case job.name

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module ForumTopicsHelper
def forum_topic_category_select(object, field)
select(object, field, ForumTopic.reverse_category_mapping.to_a)

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module IconHelper
def icon_tag(icon_class, class: nil, **options)
klass = binding.local_variable_get(:class)

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module IpAddressesHelper
# https://www.bing.com/maps/embed-a-map
# https://docs.microsoft.com/en-us/bingmaps/articles/create-a-custom-map-url

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module NoteVersionsHelper
def note_version_position_diff(note_version, type)
other = note_version.send(type)

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module PoolVersionsHelper
def pool_version_show_diff(pool_version, type)
other = pool_version.send(type)

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module PopularPostsHelper
def next_date_for_scale(date, scale)
case scale

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module PostVersionsHelper
def post_version_diff(post_version, type)
return "" if type == "previous" && post_version.version == 1
@@ -22,7 +24,7 @@ module PostVersionsHelper
obsolete_added_tags = added_tags - other_tags
obsolete_removed_tags = removed_tags & other_tags
end
html = '<span class="diff-list">'
html = '<span class="diff-list">'.dup
added_tags.each do |tag|
obsolete_class = (obsolete_added_tags.include?(tag) ? "diff-obsolete" : "")

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module PostsHelper
def reportbooru_enabled?
Danbooru.config.reportbooru_server.present? && Danbooru.config.reportbooru_key.present?

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
# https://yoast.com/structured-data-schema-ultimate-guide/
# https://technicalseo.com/tools/schema-markup-generator/
# https://developers.google.com/search/docs/data-types/sitelinks-searchbox

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module TagsHelper
def tag_class(tag)
return nil if tag.blank?

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module UploadsHelper
def render_status(upload)
case upload.status

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module UserUpgradesHelper
def cents_to_usd(cents)
number_to_currency(cents / 100, precision: 0)

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module UsersHelper
def unread_dmail_indicator(user)
"(#{user.unread_dmail_count})" if user.unread_dmail_count > 0

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WikiPageVersionsHelper
def wiki_version_show_diff(wiki_page_version, type)
other = wiki_page_version.send(type)

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WikiPagesHelper
def wiki_page_other_names_list(wiki_page)
names_html = wiki_page.other_names.map do |name|