Add cop to deprecate `include ActionView::Helpers::UrlHelper`
Description of the proposal
include ActionView::Helpers::UrlHelper
adds ~40 methods to the
class. And it caused a bug in
https://gitlab.com/gitlab-org/ci-cd/release-group/release/-/issues/84
Most of the time it's included for link_to
method, which can be
replaced with:
url = Gitlab::Routing.url_helpers.project_blob_path(...)
ActionController::Base.helpers.link_to(url, link_text)
See gitlab-org/gitlab#340567 (closed) for details
Offences
Offences
Offenses:
app/models/integrations/asana.rb:7:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/bamboo.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/bugzilla.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/campfire.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/confluence.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/custom_issue_tracker.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/datadog.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/discord.rb:7:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/ewm.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/external_wiki.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/flowdock.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/hangouts_chat.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/irker.rb:7:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/jenkins.rb:6:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/mattermost.rb:6:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/pivotaltracker.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/redmine.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/webex_teams.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/integrations/youtrack.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/presenters/alert_management/alert_presenter.rb:7:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/presenters/ci/pipeline_presenter.rb:6:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/presenters/clusters/cluster_presenter.rb:7:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/presenters/environment_presenter.rb:4:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/presenters/gitlab/blame_presenter.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/presenters/group_clusterable_presenter.rb:5:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/presenters/instance_clusterable_presenter.rb:5:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/presenters/merge_request_presenter.rb:4:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/presenters/project_clusterable_presenter.rb:5:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/presenters/project_presenter.rb:5:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/presenters/prometheus_alert_presenter.rb:4:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/presenters/release_presenter.rb:4:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/presenters/releases/evidence_presenter.rb:5:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ee/app/helpers/license_helper.rb:5:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ee/app/models/integrations/github.rb:6:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ee/app/presenters/merge_request_approver_presenter.rb:10:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ee/spec/helpers/ee/projects/security/configuration_helper_spec.rb:6:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ee/spec/lib/banzai/filter/cross_project_issuable_information_filter_spec.rb:6:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ee/spec/lib/banzai/filter/issuable_state_filter_spec.rb:5:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/gitlab/ci/badge/metadata.rb:11:7: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/gitlab/email/message/in_product_marketing/helper.rb:10:11: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/helpers/merge_requests_helper_spec.rb:6:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/helpers/nav/top_nav_helper_spec.rb:6:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/helpers/notify_helper_spec.rb:6:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/lib/banzai/filter/issuable_state_filter_spec.rb:6:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/lib/banzai/filter/reference_redactor_filter_spec.rb:6:3: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/lib/banzai/reference_redactor_spec.rb:109:5: C: Gitlab/UrlHelpers: Avoid including ActionView::Helpers::UrlHelper.
It adds/overrides ~40 methods while usualy only one is needed.
Instead, use the Gitlab::Routing.url_helpers and ActionController::Base.helpers.link_to.
See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
include ActionView::Helpers::UrlHelper
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Check-list
-
Mention this proposal in the relevant Slack channels (e.g. #development
,#backend
,#frontend
) -
The MR doesn't have significant objections, and is getting a majority of 👍 vs👎 (remember that we don't need to reach a consensus) -
(If applicable) One style is getting a majority of vote (compared to the other choice) -
(If applicable) Update the MR with the chosen style -
Follow the review process as usual
Edited by Vladimir Shushlin