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-03 21:08:55 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-03 21:08:55 +0300
commit8f9307985ea047abb5b8a7c6c56bb644e0b7c363 (patch)
tree474c91c280b903c345bd94f4842abf481c535656 /haml_lint
parent3cda3d43aef1e92e2eedf7383122c6db9c61149f (diff)
Add latest changes from gitlab-org/gitlab@master
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