Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-01-12 12:10:49 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-01-12 12:10:49 +0300
commit9c07ab8c6975de1046bd65b36f3d34f5408dac13 (patch)
treef17da714b7b4ea77aa16ebfae62766a694247c7e /rubocop
parent38780f3d2f18d9e07fe3e7427ccc964de267dbb4 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop')
-rw-r--r--rubocop/cop/lint/last_keyword_argument.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/rubocop/cop/lint/last_keyword_argument.rb b/rubocop/cop/lint/last_keyword_argument.rb
index 430ea66e9a1..0910577ad67 100644
--- a/rubocop/cop/lint/last_keyword_argument.rb
+++ b/rubocop/cop/lint/last_keyword_argument.rb
@@ -16,7 +16,7 @@ module RuboCop
KEYWORD_DEPRECATION_STR = 'maybe ** should be added to the call'
def on_send(node)
- arg = node.arguments.last
+ arg = get_last_argument(node)
return unless arg
return unless known_match?(processed_source.file_path, node.first_line, node.method_name.to_s)
@@ -44,6 +44,12 @@ module RuboCop
private
+ def get_last_argument(node)
+ return node.arguments[-2] if node.block_argument?
+
+ node.arguments.last
+ end
+
def known_match?(file_path, line_number, method_name)
file_path_from_root = file_path.sub(File.expand_path('../../..', __dir__), '')