summaryrefslogtreecommitdiff
path: root/rubocop/cop/lint
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 19:00:14 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 19:00:14 +0000
commit05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch)
tree11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /rubocop/cop/lint
parentec73467c23693d0db63a797d10194da9e72a74af (diff)
downloadgitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'rubocop/cop/lint')
-rw-r--r--rubocop/cop/lint/last_keyword_argument.rb8
1 files changed, 5 insertions, 3 deletions
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