DEV: enable frozen string literal on all files

DEV: enable frozen string literal on all files

This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging

diff --git a/.rubocop.yml b/.rubocop.yml
index 9d2e219..5c99bdc 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -12,6 +12,9 @@ AllCops:
 Style/AndOr:
   Enabled: true
 
+Style/FrozenStringLiteralComment:
+  Enabled: true
+
 # Do not use braces for hash literals when they are the last argument of a
 # method call.
 Style/BracesAroundHashParameters:
diff --git a/Brewfile b/Brewfile
index 8959513..424d53b 100644
--- a/Brewfile
+++ b/Brewfile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 # Install development dependencies on Mac OS X using Homebrew (http://mxcl.github.com/homebrew)
 
 # you probably already have git installed; ensure that it is the latest version
diff --git a/Dangerfile b/Dangerfile
index b8f8423..72c02d7 100644
--- a/Dangerfile
+++ b/Dangerfile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 if github.pr_json && (github.pr_json["additions"] || 0) > 250 || (github.pr_json["deletions"] || 0) > 250
   warn("This pull request is big! We prefer smaller PRs whenever possible, as they are easier to review. Can this be split into a few smaller PRs?")
 end
diff --git a/Gemfile b/Gemfile
index deb7938..b15625e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 source 'https://rubygems.org'
 # if there is a super emergency and rubygems is playing up, try
 #source 'http://production.cf.rubygems.org'
diff --git a/Rakefile b/Rakefile
index 7a7f9ee..dc7fdf2 100755
--- a/Rakefile
+++ b/Rakefile
@@ -1,4 +1,6 @@
 #!/usr/bin/env rake
+# 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/controllers/about_controller.rb b/app/controllers/about_controller.rb
index 3408239..03336bd 100644
--- a/app/controllers/about_controller.rb
+++ b/app/controllers/about_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require_dependency 'rate_limiter'
 
 class AboutController < ApplicationController
diff --git a/app/controllers/admin/emojis_controller.rb b/app/controllers/admin/emojis_controller.rb
index 649ebec..f8baa5d 100644
--- a/app/controllers/admin/emojis_controller.rb
+++ b/app/controllers/admin/emojis_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require_dependency 'upload_creator'
 
 class Admin::EmojisController < Admin::AdminController
diff --git a/app/controllers/admin/flagged_topics_controller.rb b/app/controllers/admin/flagged_topics_controller.rb
index 82e7b68..10680b9 100644
--- a/app/controllers/admin/flagged_topics_controller.rb
+++ b/app/controllers/admin/flagged_topics_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require_dependency 'flag_query'
 
 class Admin::FlaggedTopicsController < Admin::AdminController
diff --git a/app/controllers/admin/flags_controller.rb b/app/controllers/admin/flags_controller.rb
index 75e9701..9ede2f7 100644
--- a/app/controllers/admin/flags_controller.rb
+++ b/app/controllers/admin/flags_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'flag_query'
 
 class Admin::FlagsController < Admin::AdminController
diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb
index c8a3280..8281655 100644
--- a/app/controllers/admin/groups_controller.rb
+++ b/app/controllers/admin/groups_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Admin::GroupsController < Admin::AdminController
   def bulk
   end
diff --git a/app/controllers/admin/impersonate_controller.rb b/app/controllers/admin/impersonate_controller.rb
index 31727d0..8045f20 100644
--- a/app/controllers/admin/impersonate_controller.rb
+++ b/app/controllers/admin/impersonate_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Admin::ImpersonateController < Admin::AdminController
 
   def create
diff --git a/app/controllers/admin/permalinks_controller.rb b/app/controllers/admin/permalinks_controller.rb
index b00978f..4b04249 100644
--- a/app/controllers/admin/permalinks_controller.rb
+++ b/app/controllers/admin/permalinks_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Admin::PermalinksController < Admin::AdminController
 
   before_action :fetch_permalink, only: [:destroy]
diff --git a/app/controllers/admin/plugins_controller.rb b/app/controllers/admin/plugins_controller.rb
index 9067fa9..8df6c9d 100644
--- a/app/controllers/admin/plugins_controller.rb
+++ b/app/controllers/admin/plugins_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Admin::PluginsController < Admin::AdminController
 
   def index
diff --git a/app/controllers/admin/reports_controller.rb b/app/controllers/admin/reports_controller.rb
index 8143d09..fe99dd7 100644
--- a/app/controllers/admin/reports_controller.rb
+++ b/app/controllers/admin/reports_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require_dependency 'report'
 
 class Admin::ReportsController < Admin::AdminController
diff --git a/app/controllers/admin/screened_emails_controller.rb b/app/controllers/admin/screened_emails_controller.rb
index 014a384..b09eecc 100644
--- a/app/controllers/admin/screened_emails_controller.rb
+++ b/app/controllers/admin/screened_emails_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Admin::ScreenedEmailsController < Admin::AdminController
 
   def index
diff --git a/app/controllers/admin/screened_ip_addresses_controller.rb b/app/controllers/admin/screened_ip_addresses_controller.rb
index 59f7742..ac3b1b8 100644
--- a/app/controllers/admin/screened_ip_addresses_controller.rb
+++ b/app/controllers/admin/screened_ip_addresses_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require_dependency 'ip_addr'
 
 class Admin::ScreenedIpAddressesController < Admin::AdminController
diff --git a/app/controllers/admin/screened_urls_controller.rb b/app/controllers/admin/screened_urls_controller.rb
index cc2e2d9..e730fbf 100644
--- a/app/controllers/admin/screened_urls_controller.rb
+++ b/app/controllers/admin/screened_urls_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Admin::ScreenedUrlsController < Admin::AdminController
 
   def index
diff --git a/app/controllers/admin/search_logs_controller.rb b/app/controllers/admin/search_logs_controller.rb
index 280121e..1836df6 100644
--- a/app/controllers/admin/search_logs_controller.rb
+++ b/app/controllers/admin/search_logs_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Admin::SearchLogsController < Admin::AdminController
 
   def index
diff --git a/app/controllers/admin/site_settings_controller.rb b/app/controllers/admin/site_settings_controller.rb
index 3a894e1..546d797 100644
--- a/app/controllers/admin/site_settings_controller.rb
+++ b/app/controllers/admin/site_settings_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Admin::SiteSettingsController < Admin::AdminController
   rescue_from Discourse::InvalidParameters do |e|
     render_json_error e.message, status: 422
diff --git a/app/controllers/admin/site_texts_controller.rb b/app/controllers/admin/site_texts_controller.rb
index fe235bf..65e6062 100644
--- a/app/controllers/admin/site_texts_controller.rb
+++ b/app/controllers/admin/site_texts_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require_dependency 'seed_data/categories'
 require_dependency 'seed_data/topics'
 
diff --git a/app/controllers/admin/staff_action_logs_controller.rb b/app/controllers/admin/staff_action_logs_controller.rb
index 46ad493..f51d60d 100644
--- a/app/controllers/admin/staff_action_logs_controller.rb
+++ b/app/controllers/admin/staff_action_logs_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Admin::StaffActionLogsController < Admin::AdminController
 
   def index
@@ -22,7 +24,7 @@ class Admin::StaffActionLogsController < Admin::AdminController
 
     diff_fields = {}
 
-    output = "<h2>#{CGI.escapeHTML(cur["name"].to_s)}</h2><p></p>"

[... diff too long, it was truncated ...]

GitHub sha: 30990006