From bd37e94aecac7ef361a605bc1a5433415a4526cc Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 17 Jan 2023 03:07:21 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- rubocop/cop/lint/last_keyword_argument.rb | 8 +++++--- rubocop/rubocop-ruby30.yml | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'rubocop') diff --git a/rubocop/cop/lint/last_keyword_argument.rb b/rubocop/cop/lint/last_keyword_argument.rb index 3f5ad7e20d7..f50c25f7924 100644 --- a/rubocop/cop/lint/last_keyword_argument.rb +++ b/rubocop/cop/lint/last_keyword_argument.rb @@ -18,6 +18,8 @@ module RuboCop KEYWORD_DEPRECATION_STR = 'maybe ** should be added to the call' def on_send(node) + return if target_ruby_version >= 3.0 + arg = get_last_argument(node) return unless arg @@ -49,13 +51,13 @@ module RuboCop end def known_match?(file_path, line_number, method_name) - file_path_from_root = file_path.sub(File.expand_path('../../..', __dir__), '') - file_and_line = "#{file_path_from_root}:#{line_number}" - method_name = 'initialize' if method_name == 'new' return unless self.class.keyword_warnings[method_name] + file_path_from_root = file_path.sub(File.expand_path('../../..', __dir__), '') + file_and_line = "#{file_path_from_root}:#{line_number}" + self.class.keyword_warnings[method_name].any? do |warning| warning.include?(file_and_line) end diff --git a/rubocop/rubocop-ruby30.yml b/rubocop/rubocop-ruby30.yml index 6cd3f66ce55..b7634210e3d 100644 --- a/rubocop/rubocop-ruby30.yml +++ b/rubocop/rubocop-ruby30.yml @@ -14,3 +14,7 @@ Style/MutableConstant: Enabled: false Style/RedundantFreeze: Enabled: false + +# No longer needed because Ruby 3.0 will fail due to kwargs issues. +Lint/LastKeywordArgument: + Enabled: false -- cgit v1.2.3