Danger: Fix warning about forwarding private methods
What does this MR do and why?
Previously, we were using forwardable
but it emitted a mysterious warning:
/builds/gitlab-org/gitlab/tooling/danger/suggestor.rb:35: warning: Tooling::Danger::Suggestion#helper at /builds/gitlab-org/gitlab/vendor/ruby/3.0.0/gems/forwardable-1.3.3/lib/forwardable.rb:159 forwarding to private method Danger::Rubocop#helper
/builds/gitlab-org/gitlab/tooling/danger/suggestor.rb:35: warning: Tooling::Danger::Suggestion#helper at /builds/gitlab-org/gitlab/vendor/ruby/3.0.0/gems/forwardable-1.3.3/lib/forwardable.rb:159 forwarding to private method Danger::Rubocop#helper
/builds/gitlab-org/gitlab/tooling/danger/suggestor.rb:35: warning: Tooling::Danger::Suggestion#helper at /builds/gitlab-org/gitlab/vendor/ruby/3.0.0/gems/forwardable-1.3.3/lib/forwardable.rb:159 forwarding to private method Danger::Rubocop#helper
/builds/gitlab-org/gitlab/tooling/danger/suggestor.rb:35: warning: Tooling::Danger::Suggestion#helper at /builds/gitlab-org/gitlab/vendor/ruby/3.0.0/gems/forwardable-1.3.3/lib/forwardable.rb:159 forwarding to private method Danger::Rubocop#helper
/builds/gitlab-org/gitlab/tooling/danger/suggestor.rb:35: warning: Tooling::Danger::Suggestion#helper at /builds/gitlab-org/gitlab/vendor/ruby/3.0.0/gems/forwardable-1.3.3/lib/forwardable.rb:159 forwarding to private method Danger::Rubocop#helper
/builds/gitlab-org/gitlab/tooling/danger/suggestor.rb:35: warning: Tooling::Danger::Suggestion#helper at /builds/gitlab-org/gitlab/vendor/ruby/3.0.0/gems/forwardable-1.3.3/lib/forwardable.rb:159 forwarding to private method Danger::Rubocop#helper
/builds/gitlab-org/gitlab/tooling/danger/suggestor.rb:35: warning: Tooling::Danger::Suggestion#helper at /builds/gitlab-org/gitlab/vendor/ruby/3.0.0/gems/forwardable-1.3.3/lib/forwardable.rb:159 forwarding to private method Danger::Rubocop#helper
/builds/gitlab-org/gitlab/tooling/danger/suggestor.rb:35: warning: Tooling::Danger::Suggestion#helper at /builds/gitlab-org/gitlab/vendor/ruby/3.0.0/gems/forwardable-1.3.3/lib/forwardable.rb:159 forwarding to private method Danger::Rubocop#helper
The reason is unknown because helper
is a public method.
As a workaround we are switching to hand-made delegates.
Screenshots or screen recordings
Before | After |
---|---|
|
|
How to set up and validate locally
- Apply this diff and commit
diff --git a/app/models/project.rb b/app/models/project.rb
index f7e994d4beb5..49eb90399923 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -56,7 +56,7 @@ class Project < ApplicationRecord
extend Gitlab::ConfigHelper
BoardLimitExceeded = Class.new(StandardError)
- ExportLimitExceeded = Class.new(StandardError)
+ ExportLimitExceeded = Class.new(StandardError) # rubocop:disable Foo/Var
STATISTICS_ATTRIBUTE = 'repositories_count'
UNKNOWN_IMPORT_URL = 'http://unknown.git'
- On this MR, run
bundle exec danger dry_run
- No warnings
✅ - On master, run
bundle exec danger dry_run
- See warnings
⚠
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 Peter Leitzen