diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
commit | b39512ed755239198a9c294b6a45e65c05900235 (patch) | |
tree | d234a3efade1de67c46b9e5a38ce813627726aa7 /config/initializers/00_deprecations.rb | |
parent | d31474cf3b17ece37939d20082b07f6657cc79a9 (diff) |
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'config/initializers/00_deprecations.rb')
-rw-r--r-- | config/initializers/00_deprecations.rb | 33 |
1 files changed, 33 insertions, 0 deletions
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 |