diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 13:49:51 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 13:49:51 +0000 |
commit | 71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch) | |
tree | 6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /haml_lint | |
parent | a7253423e3403b8c08f8a161e5937e1488f5f407 (diff) | |
download | gitlab-ce-71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e.tar.gz |
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'haml_lint')
-rw-r--r-- | haml_lint/linter/documentation_links.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/haml_lint/linter/documentation_links.rb b/haml_lint/linter/documentation_links.rb index 0cabae40c4b..9d80344dd20 100644 --- a/haml_lint/linter/documentation_links.rb +++ b/haml_lint/linter/documentation_links.rb @@ -9,11 +9,12 @@ module HamlLint class DocumentationLinks < Linter include ::HamlLint::LinterRegistry include ::Gitlab::Utils::Markdown + extend ::RuboCop::AST::NodePattern::Macros DOCS_DIRECTORY = File.join(File.expand_path('../..', __dir__), 'doc') - HELP_PATH_LINK_PATTERN = <<~PATTERN - (send nil? {:help_page_url :help_page_path} $...) + def_node_matcher :help_link, <<~PATTERN + (send _ {:help_page_url :help_page_path} $...) PATTERN MARKDOWN_HEADER = %r{\A\#{1,6}\s+(?<header>.+)\Z}.freeze @@ -59,7 +60,7 @@ module HamlLint end def extract_link_and_anchor(ast_tree) - link_match, attributes_match = ::RuboCop::NodePattern.new(HELP_PATH_LINK_PATTERN).match(ast_tree) + link_match, attributes_match = help_link(ast_tree) { link: fetch_link(link_match), anchor: fetch_anchor(attributes_match) }.compact end |