From 51ac5bdc1c9f82d369124fb63375168c3cfc1a92 Mon Sep 17 00:00:00 2001 From: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Date: Tue, 16 Jan 2024 12:55:47 -0500 Subject: [PATCH] Ignore camel case in heading capitalization, add double slash and double parentheses rules to Vale (#6165) Signed-off-by: Fanit Kolchina --- .github/vale/styles/OpenSearch/HeadingCapitalization.yml | 3 ++- .github/vale/styles/OpenSearch/LinksDoubleParentheses.yml | 8 ++++++++ .github/vale/styles/OpenSearch/LinksDoubleSlash.yml | 7 +++++++ .github/vale/tests/test-style-neg.md | 4 ++++ .github/vale/tests/test-style-pos.md | 4 ++++ .vale.ini | 2 ++ 6 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .github/vale/styles/OpenSearch/LinksDoubleParentheses.yml create mode 100644 .github/vale/styles/OpenSearch/LinksDoubleSlash.yml diff --git a/.github/vale/styles/OpenSearch/HeadingCapitalization.yml b/.github/vale/styles/OpenSearch/HeadingCapitalization.yml index 990fde0b..ccd81bc5 100644 --- a/.github/vale/styles/OpenSearch/HeadingCapitalization.yml +++ b/.github/vale/styles/OpenSearch/HeadingCapitalization.yml @@ -9,4 +9,5 @@ indicators: - ")" exceptions: - k # ignores lowercase k-NN - - '[A-Z]{2,}' # ignores all acronyms \ No newline at end of file + - '[A-Z]{2,}' # ignores all acronyms + - '([A-Z][a-z0-9]+){2,}' # ignores all camel case words \ No newline at end of file diff --git a/.github/vale/styles/OpenSearch/LinksDoubleParentheses.yml b/.github/vale/styles/OpenSearch/LinksDoubleParentheses.yml new file mode 100644 index 00000000..9a59479f --- /dev/null +++ b/.github/vale/styles/OpenSearch/LinksDoubleParentheses.yml @@ -0,0 +1,8 @@ +extends: existence +message: "Remove double slashes from the link '%s'." +level: error +nonword: true +scope: raw +tokens: + - '\[.*\](\(){2,}.*(\)){1,}' + - '\[.*\](\(){1,}.*(\)){2,}' \ No newline at end of file diff --git a/.github/vale/styles/OpenSearch/LinksDoubleSlash.yml b/.github/vale/styles/OpenSearch/LinksDoubleSlash.yml new file mode 100644 index 00000000..369db6a1 --- /dev/null +++ b/.github/vale/styles/OpenSearch/LinksDoubleSlash.yml @@ -0,0 +1,7 @@ +extends: existence +message: "Remove double slashes from the link '%s'." +level: error +nonword: true +scope: raw +tokens: + - '\(\{\{site.url\}\}\{\{site.baseurl\}\}.*\/{2,}.*\)' diff --git a/.github/vale/tests/test-style-neg.md b/.github/vale/tests/test-style-neg.md index 98f5837b..4b474cb0 100644 --- a/.github/vale/tests/test-style-neg.md +++ b/.github/vale/tests/test-style-neg.md @@ -32,6 +32,10 @@ This sentence tests Latin substitution through using Latin. ## This heading: Tests colons but fails capitalization +This sentence tests [links double parentheses]({{site.url}}{{site.baseurl}}/opensearch/). + +This sentence tests [links double slash]({{site.url}}{{site.baseurl}}/opensearch/). + This sentence tests [links end slash]({{site.url}}{{site.baseurl}}/opensearch/). This sentence tests [links mid slash]({{site.url}}{{site.baseurl}}/opensearch/). diff --git a/.github/vale/tests/test-style-pos.md b/.github/vale/tests/test-style-pos.md index f9ac0e71..7ab71a36 100644 --- a/.github/vale/tests/test-style-pos.md +++ b/.github/vale/tests/test-style-pos.md @@ -32,6 +32,10 @@ This sentence tests Latin substitution via using Latin. ## This heading: tests colons +This sentence tests [links double parentheses](({{site.url}}{{site.baseurl}}/opensearch/)). + +This sentence tests [links double slash]({{site.url}}{{site.baseurl}}/opensearch//double-slash/). + This sentence tests [links end slash]({{site.url}}{{site.baseurl}}/opensearch). This sentence tests [links mid slash]({{site.url}}{{site.baseurl}}opensearch). diff --git a/.vale.ini b/.vale.ini index 2b195b4d..a87a8a06 100644 --- a/.vale.ini +++ b/.vale.ini @@ -36,6 +36,8 @@ OpenSearch.HeadingPunctuation = YES OpenSearch.Inclusive = YES OpenSearch.LatinismsElimination = YES OpenSearch.LatinismsSubstitution = YES +OpenSearch.LinksDoubleParentheses = YES +OpenSearch.LinksDoubleSlash = YES OpenSearch.LinksEndSlash = YES OpenSearch.LinksMidSlash = YES OpenSearch.LoginNoun = YES