From b39512ed755239198a9c294b6a45e65c05900235 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 18 Aug 2022 08:17:02 +0000 Subject: Add latest changes from gitlab-org/gitlab@15-3-stable-ee --- config/initializers/00_deprecations.rb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 config/initializers/00_deprecations.rb (limited to 'config/initializers/00_deprecations.rb') diff --git a/config/initializers/00_deprecations.rb b/config/initializers/00_deprecations.rb new file mode 100644 index 00000000000..bfbd57c99fe --- /dev/null +++ b/config/initializers/00_deprecations.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Disallowed deprecation warnings are silenced in production. For performance +# reasons we even skip the definition of disallowed warnings in production. +# +# See +# * https://gitlab.com/gitlab-org/gitlab/-/issues/368379 for a follow-up +# * https://gitlab.com/gitlab-org/gitlab/-/merge_requests/92557#note_1032212676 +# for benchmarks +# +# In Rails 7 we will use `config.active_support.report_deprecations = false` +# instead of this early return. +if Rails.env.production? + ActiveSupport::Deprecation.silenced = true + return +end + +# Ban the following deprecation warnings and turn them into runtime errors +# in `development` and `test` environments. +# +# This way we prevent already fixed warnings from sneaking back into the codebase silently. +rails7_deprecation_warnings = [ + # https://gitlab.com/gitlab-org/gitlab/-/issues/339739 + /ActiveModel::Errors#keys is deprecated/, + # https://gitlab.com/gitlab-org/gitlab/-/issues/342492 + /Rendering actions with '\.' in the name is deprecated/, + # https://gitlab.com/gitlab-org/gitlab/-/issues/333086 + /default_hash is deprecated/, + # https://gitlab.com/gitlab-org/gitlab/-/issues/369970 + /Passing an Active Record object to `\w+` directly is deprecated/ +] + +ActiveSupport::Deprecation.disallowed_warnings.concat rails7_deprecation_warnings -- cgit v1.2.3