Resolve all offenses for InternalAffairs/UseRestrictOnSend
What does this MR do and why?
This MRs fixes all (5) offenses for InternalAffairs/UseRestrictOnSend
and regenerates TODOs.
Before adjusting production code each spec has been improved to increase code (branch) coverage and cover edge cases.
Using RESTRICT_ON_SEND
improves performances and simplifies code. See https://docs.rubocop.org/rubocop/development.html#create-a-new-cop
The
on_send
callback is the most used and can be optimized by restricting the acceptable method names with a constantRESTRICT_ON_SEND
.
Best is to review individual commits.
gitlab-org/gitlab
Impact on Verified via
diff --git a/Gemfile b/Gemfile
index 312c8313ccff..a62f952b8905 100644
--- a/Gemfile
+++ b/Gemfile
@@ -435,7 +435,9 @@ group :development, :test do
gem 'spring', '~> 4.1.0' # rubocop:todo Gemfile/MissingFeatureCategory
gem 'spring-commands-rspec', '~> 1.0.4' # rubocop:todo Gemfile/MissingFeatureCategory
- gem 'gitlab-styles', '~> 11.0.0', require: false # rubocop:todo Gemfile/MissingFeatureCategory
+ gem 'gitlab-styles', '~> 11.0.0', require: false, # rubocop:todo Gemfile/MissingFeatureCategory
+ git: 'https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles.git',
+ ref: 'pl-resolve-use-restrict-on-send'
gem 'haml_lint', '~> 0.53', require: false # rubocop:todo Gemfile/MissingFeatureCategory
gem 'bundler-audit', '~> 0.9.1', require: false # rubocop:todo Gemfile/MissingFeatureCategory
and
$ be rubocop --parallel --only Cop/WithoutReactiveCache,Cop/ActiveRecordSerialize,Cop/InBatches,Cop/PolymorphicAssociations,Cop/WithoutReactiveCache
ee/spec/features/projects/pipelines/user_sees_security_tab_spec.rb: RSpec/FactoryBot/ExcessiveCreateList has the wrong namespace - should be FactoryBot
spec/features/environments/environments_folder_spec.rb: RSpec/FactoryBot/ExcessiveCreateList has the wrong namespace - should be FactoryBot
spec/features/environments/environments_folder_spec.rb: RSpec/FactoryBot/ExcessiveCreateList has the wrong namespace - should be FactoryBot
Inspecting 34298 files
...
34298 files inspected, no offenses detected
No issues.
Edited by Peter Leitzen