Vale config should only apply to markdown files in /doc
What does this MR do and why?
I was checking the .vale.ini
file and found a surprise addition. You can see that Arturo added this [gems/**/*.md]
section in !206046 (merged), because Vale was failing: https://gitlab.com/gitlab-org/gitlab/-/jobs/11460289451
It seems like our script is picking up files outside of the doc/
directory:
Finding: doc/development/ai_features/glossary.md gems/gitlab-active-context/doc/usage.md
So what's causing that? Is it possible that the regex here is a substring search?
-
file_filter: ->(file) { !file['deleted_file'] && file['new_path'] =~ %r{doc/.*\.md|\.vale|\.markdownlint|lint-doc\.sh|docs\.gitlab-ci\.yml} },
So it matches any path with
doc/.*\.md
in any part of the path?
I somewhat reproduced it in this MR. Ignore the markdownlint errors, that's just a byproduct of tweaking the script to think only markdown files were changed: https://gitlab.com/gitlab-org/gitlab/-/jobs/11587523718
References
Screenshots or screen recordings
Before | After |
---|---|
How to set up and validate locally
Export some variables for all of your test runs:
export CI_API_V4_URL=https://gitlab.com/api/v4
export CI_MERGE_REQUEST_PROJECT_PATH=gitlab-org/gitlab
Then you can run the script for any MR you would like to verify which files are getting linted: CI_MERGE_REQUEST_IID=<mr-id> scripts/lint-doc.sh
The MR in question (!206046 (merged)) can be tested with CI_MERGE_REQUEST_IID=206046 scripts/lint-doc.sh
and produces this result:
.vale.ini doc/development/ai_features/glossary.md
INFO: Vale, Markdownlint, lint-doc.sh, or pipeline configuration changed. Testing all files.
On master, it instead produces this result:
.vale.ini doc/development/ai_features/glossary.md gems/gitlab-active-context/doc/usage.md
INFO: Vale, Markdownlint, lint-doc.sh, or pipeline configuration changed. Testing all files.
While it would lint all files, you can see that it no longer detects the file change inside the gems/
directory.
This test can be repeated with any MR you like. You don't need to set anything up locally except those environment variables before running the script (maybe you need to do a gem install httparty --no-document --version 0.20.0 && gem install gitlab --no-document --version 4.19.0
like the pipeline does.).
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.