Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-20 16:49:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-20 16:49:51 +0300
commit71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch)
tree6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /haml_lint
parenta7253423e3403b8c08f8a161e5937e1488f5f407 (diff)
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.rb7
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