Skip to content

Linter/DocumentationLinks: Flag help links with receivers

Peter Leitzen requested to merge pl-haml-lint-documentation-links-fix into master

What does this MR do and why?

This MR fixes the HAML linter rule Linter/DocumentationLinks to flag the invalid use of page links with receivers.

Now, the following examples are matched:

= Rails.application.routes.url_helpers.help_page_path("invalid/path")
= Gitlab::Routing.url_helpers.help_page_path("invalid/path")
= Actually::Anything::NotGonnaLie.help_page_path("invalid/path")

It also improves the speed of the rule by caching the compilation of the node pattern 🚀

For example, this improves the runtime for haml-lint app/views/shared by 2.5s (19s -> 16.5s) 🎉

This MR also fixes the sole offense in ee/app/views/shared/issuable/form/_merge_request_blocks.html.haml.

How to set up and validate locally

Before

$ bundle exec haml-lint  ee/app/views/shared/issuable/form/_merge_request_blocks.html.haml
ee/app/views/shared/issuable/form/_merge_request_blocks.html.haml:15 [W] DocumentationLinks: help_page_path points to the unknown location: /home/peter/devel/gitlab/gdk/gitlab/doc/user/project/merge_requests/dependencies.html.md

1 file inspected, 1 lint detected

See https://gitlab.com/gitlab-org/gitlab/-/jobs/3709855812

After

$ bundle exec haml-lint  ee/app/views/shared/issuable/form/_merge_request_blocks.html.haml

1 file inspected, 0 lints detected

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Peter Leitzen

Merge request reports