Commit a8c5858c authored by Vasilii Iakliushin's avatar Vasilii Iakliushin Committed by Mayra Cabrera

Follow-up for product suffixes removal

Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/218764
Follow-up for:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39717
After merging:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39715

* Revert an approximate match in the documentation linter
* Revert an allow_failure: true behavior
* Update a regular expression to remove false-positives in the linter
parent b6e5b641
......@@ -45,7 +45,6 @@ docs lint:
image: "registry.gitlab.com/gitlab-org/gitlab-docs/lint:vale-2.3.4-markdownlint-0.23.2"
stage: test
needs: []
allow_failure: true
script:
- scripts/lint-doc.sh
# Prepare docs for build
......
......@@ -1656,7 +1656,7 @@ job:
- /^release/.*$/@gitlab-org/gitlab
```
The above example will run `job` for all branches on `gitlab-org/gitlab`,
The above example runs `job` for all branches on `gitlab-org/gitlab`,
except `master` and those with names prefixed with `release/`.
If a job does not have an `only` rule, `only: ['branches', 'tags']` is set by
......
......@@ -92,8 +92,7 @@ module HamlLint
File.open(path_to_file).any? do |line|
result = line.match(MARKDOWN_HEADER)
# TODO:Do an exact match for anchors (Follow-up https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39850)
anchor.start_with?(string_to_anchor(result[:header].delete('*'))) if result
string_to_anchor(result[:header]) == anchor if result
end
end
end
......
......@@ -4,7 +4,7 @@ module Gitlab
module Utils
module Markdown
PUNCTUATION_REGEXP = /[^\p{Word}\- ]/u.freeze
PRODUCT_SUFFIX = /\s*\((core|starter|premium|ultimate)(\s+only)?\)/.freeze
PRODUCT_SUFFIX = /\s*\**\((core|starter|premium|ultimate)(\s+only)?\)\**/.freeze
def string_to_anchor(string)
string
......
......@@ -20,13 +20,6 @@ RSpec.describe HamlLint::Linter::DocumentationLinks do
it { is_expected.not_to report_lint }
end
# TODO: Remove me after https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39715 is merged
context 'when link_to points to the existing file with partially matching anchor' do
let(:haml) { "= link_to 'Description', help_page_path('README.md', anchor: 'overview-premium'), target: '_blank'" }
it { is_expected.not_to report_lint }
end
context 'when link_to points to the existing file path without .md extension' do
let(:haml) { "= link_to 'Description', help_page_path('README')" }
......
......@@ -66,6 +66,22 @@ RSpec.describe Gitlab::Utils::Markdown do
is_expected.to eq 'my-header'
end
end
context 'with "*" around a product suffix' do
let(:string) { 'My Header **(STARTER)**' }
it 'ignores a product suffix' do
is_expected.to eq 'my-header'
end
end
context 'with "*" around a product suffix and only modifier' do
let(:string) { 'My Header **(STARTER ONLY)**' }
it 'ignores a product suffix' do
is_expected.to eq 'my-header'
end
end
end
context 'when string is empty' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment