diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-12 09:10:49 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-12 09:10:49 +0000 |
commit | 9c07ab8c6975de1046bd65b36f3d34f5408dac13 (patch) | |
tree | f17da714b7b4ea77aa16ebfae62766a694247c7e /rubocop/cop | |
parent | 38780f3d2f18d9e07fe3e7427ccc964de267dbb4 (diff) | |
download | gitlab-ce-9c07ab8c6975de1046bd65b36f3d34f5408dac13.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop/cop')
-rw-r--r-- | rubocop/cop/lint/last_keyword_argument.rb | 8 |
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__), '') |