Fix Rubocop failures in Ruby 3.1
What does this MR do and why?
This commit fixes a number of Rubocop failures flagged in Ruby 3.1: https://gitlab.com/gitlab-org/gitlab/-/jobs/3923877778
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Stan Hu