git: 33856d1e84 - main - Vale: Add rule to avoid superfluous optional argument in link

From: Lorenzo Salvadore <salvadore_at_FreeBSD.org>
Date: Tue, 25 Apr 2023 10:43:31 UTC
The branch main has been updated by salvadore:

URL: https://cgit.FreeBSD.org/doc/commit/?id=33856d1e846bd2d63c6bc76526a68f94ed5feaa1

commit 33856d1e846bd2d63c6bc76526a68f94ed5feaa1
Author:     Lorenzo Salvadore <salvadore@FreeBSD.org>
AuthorDate: 2023-04-14 08:14:43 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2023-04-25 10:43:21 +0000

    Vale: Add rule to avoid superfluous optional argument in link
    
    Suggest to empty square brackets in `link:` macros when the displayed
    text coincides with the URL.
    
    Reviewed by:    bofh, grahamperrin
    Approved by:    carlavilla (mentor)
    Differential Revision: https://reviews.freebsd.org/D39569
---
 .vale.ini                                         | 2 ++
 .vale/styles/FreeBSD/SuperfluousOptArgInLinks.yml | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/.vale.ini b/.vale.ini
index 46d3593082..471e9e97a5 100644
--- a/.vale.ini
+++ b/.vale.ini
@@ -19,6 +19,7 @@ FreeBSD.ConsciousLanguage = NO
 FreeBSD.Contractions = NO
 FreeBSD.Hang = NO
 FreeBSD.Hyphens = NO
+FreeBSD.SuperfluousOptArgInLinks = NO
 FreeBSD.Repitition = NO
 FreeBSD.SemanticLineBreak = NO
 FreeBSD.Spacing = NO
@@ -34,6 +35,7 @@ FreeBSD.ConsciousLanguage = NO
 FreeBSD.Contractions = NO
 FreeBSD.Hang = NO
 FreeBSD.Hyphens = NO
+FreeBSD.SuperfluousOptArgInLinks = NO
 FreeBSD.Repitition = NO
 FreeBSD.SemanticLineBreak = NO
 FreeBSD.Spacing = NO
diff --git a/.vale/styles/FreeBSD/SuperfluousOptArgInLinks.yml b/.vale/styles/FreeBSD/SuperfluousOptArgInLinks.yml
new file mode 100644
index 0000000000..36b2b4158b
--- /dev/null
+++ b/.vale/styles/FreeBSD/SuperfluousOptArgInLinks.yml
@@ -0,0 +1,7 @@
+extends: existence
+message: "Displayed text coincides with URL, leave the brackets empty: %s"
+ignorecase: true
+level: suggestion
+scope: raw
+raw:
+ - 'link:([^ ]*)\/?\[\1\/?\]'