Skip to content

A platform for community discussion. Free, open, simple.

DEV: Fix `already initialized constant` warnings (#35854)

Jarek Radosz7e8a6b6004f0
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
index 0aac5b54817..ed001cc73fe 100644
--- a/lib/tasks/import.rake
+++ b/lib/tasks/import.rake
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+MS_SPEND_CREATING_POST ||= 5000 # rubocop:disable Lint/OrAssignmentToConstant
+
# Use http://tatiyants.com/pev/#/plans/new if you want to optimize a query
task "import:ensure_consistency" => :environment do
@@ -33,8 +35,6 @@ task "import:ensure_consistency" => :environment do
log "Done!"
end
-MS_SPEND_CREATING_POST = 5000
-
# -- TODO: We need to check the queries are actually adding/updating the necessary
# data, post migration. The ON CONFLICT DO NOTHING may cause the clauses to be ignored
# when we actually need them to run.
diff --git a/lib/tasks/maxminddb.rake b/lib/tasks/maxminddb.rake
index 79cd8ed6182..8a3c19abb59 100644
--- a/lib/tasks/maxminddb.rake
+++ b/lib/tasks/maxminddb.rake
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-GEOLITE_DBS = %w[GeoLite2-City GeoLite2-ASN]
+GEOLITE_DBS ||= %w[GeoLite2-City GeoLite2-ASN] # rubocop:disable Lint/OrAssignmentToConstant
desc "downloads MaxMind's GeoLite2-City databases"
task "maxminddb:get" => "environment" do
diff --git a/lib/tasks/migrate_advanced_search_banner_to_welcome_banner.rake b/lib/tasks/migrate_advanced_search_banner_to_welcome_banner.rake
index 81245bbcbe5..e6ffe9718b0 100644
--- a/lib/tasks/migrate_advanced_search_banner_to_welcome_banner.rake
+++ b/lib/tasks/migrate_advanced_search_banner_to_welcome_banner.rake
@@ -1,11 +1,8 @@
# frozen_string_literal: true
+# rubocop:disable Lint/OrAssignmentToConstant
-THEME_GIT_URL = "https://github.com/discourse/discourse-search-banner.git" unless defined?(
- THEME_GIT_URL
-)
-REQUIRED_TRANSLATION_KEYS = %w[search_banner.headline search_banner.subhead] unless defined?(
- REQUIRED_TRANSLATION_KEYS
-)
+THEME_GIT_URL ||= "https://github.com/discourse/discourse-search-banner.git"
+REQUIRED_TRANSLATION_KEYS ||= %w[search_banner.headline search_banner.subhead]
desc "Migrate settings from Advanced Search Banner to core welcome banner"
task "themes:advanced_search_banner:migrate_settings_to_welcome_banner" => :environment do
diff --git a/lib/tasks/release_note.rake b/lib/tasks/release_note.rake
index 048d9b7776e..3f658110f20 100644
--- a/lib/tasks/release_note.rake
+++ b/lib/tasks/release_note.rake
@@ -1,8 +1,9 @@
# frozen_string_literal: true
+# rubocop:disable Lint/OrAssignmentToConstant
-DATE_REGEX = /\A\d{4}-\d{2}-\d{2}/
+DATE_REGEX ||= /\A\d{4}-\d{2}-\d{2}/
-CHANGE_TYPES = [
+CHANGE_TYPES ||= [
{ pattern: /\AFEATURE:/, heading: "New Features" },
{ pattern: /\AFIX:/, heading: "Bug Fixes" },
{ pattern: /\AUX:/, heading: "UX Changes" },