diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /rubocop/cop/lint/last_keyword_argument.rb | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'rubocop/cop/lint/last_keyword_argument.rb')
-rw-r--r-- | rubocop/cop/lint/last_keyword_argument.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/rubocop/cop/lint/last_keyword_argument.rb b/rubocop/cop/lint/last_keyword_argument.rb index 80f4660eeb8..3f5ad7e20d7 100644 --- a/rubocop/cop/lint/last_keyword_argument.rb +++ b/rubocop/cop/lint/last_keyword_argument.rb @@ -9,7 +9,9 @@ module RuboCop # 1. Running specs with RECORD_DEPRECATIONS=1 # 1. Downloading the complete set of deprecations/ files from a CI # pipeline (see https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47720) - class LastKeywordArgument < Cop + class LastKeywordArgument < RuboCop::Cop::Base + extend RuboCop::Cop::AutoCorrector + MSG = 'Using the last argument as keyword parameters is deprecated' DEPRECATIONS_GLOB = File.expand_path('../../../deprecations/**/*.yml', __dir__) @@ -26,11 +28,7 @@ module RuboCop # parser thinks `a: :b, c: :d` is hash type, it's actually kwargs return if arg.hash_type? && !arg.source.match(/\A{/) - add_offense(arg) - end - - def autocorrect(arg) - lambda do |corrector| + add_offense(arg) do |corrector| if arg.hash_type? kwarg = arg.source.sub(/\A{\s*/, '').sub(/\s*}\z/, '') corrector.replace(arg, kwarg) |