From f08f3b80edca41f82b8da51f91aa4bb1125aa8ef Mon Sep 17 00:00:00 2001 From: Peter Leitzen <pleitzen@gitlab.com> Date: Tue, 6 Feb 2024 11:23:42 +0100 Subject: [PATCH] Ignore RSpec::Parameterized deprecation warning only in Ruby 3.1 Also remove the warning to suggest dropping the ignore for Ruby 3.2. It's noisy and unnecessary. --- .rubocop_todo/style/inline_disable_annotation.yml | 1 - spec/deprecation_warnings.rb | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.rubocop_todo/style/inline_disable_annotation.yml b/.rubocop_todo/style/inline_disable_annotation.yml index c8b4dfedc410..92d1328106c9 100644 --- a/.rubocop_todo/style/inline_disable_annotation.yml +++ b/.rubocop_todo/style/inline_disable_annotation.yml @@ -2780,7 +2780,6 @@ Style/InlineDisableAnnotation: - 'spec/controllers/projects/releases_controller_spec.rb' - 'spec/controllers/projects/runners_controller_spec.rb' - 'spec/db/docs_spec.rb' - - 'spec/deprecation_warnings.rb' - 'spec/factories/design_management/designs.rb' - 'spec/factories/events.rb' - 'spec/factories/go_module_commits.rb' diff --git a/spec/deprecation_warnings.rb b/spec/deprecation_warnings.rb index abdd13ee8e7a..3ebca87f3e1f 100644 --- a/spec/deprecation_warnings.rb +++ b/spec/deprecation_warnings.rb @@ -7,13 +7,11 @@ # to developers to ease upgrading to newer Ruby versions. Warning[:deprecated] = true -# rubocop:disable Layout/LineLength +# rubocop:disable Layout/LineLength -- Avoid multiline (x modifier) Regexp to keep it readable case RUBY_VERSION[/\d+\.\d+/, 0] -when '3.2' - warn "#{__FILE__}:#{__LINE__}: warning: Ignored warnings for Ruby < 3.2 are no longer necessary." -else +when '3.1' require 'warning' - # Ignore Ruby warnings until Ruby 3.2. + # These warnings only happen in Ruby 3.1 and are gone in Ruby 3.2. # ... ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rspec-parameterized-table_syntax-1.0.0/lib/rspec/parameterized/table_syntax.rb:38: warning: Refinement#include is deprecated and will be removed in Ruby 3.2 Warning.ignore(%r{rspec-parameterized-table_syntax-1\.0\.0/lib/rspec/parameterized/table_syntax\.rb:\d+: warning: Refinement#include is deprecated}) -- GitLab