From 0fe400a82950c55a22e790c626675ce965c7debd Mon Sep 17 00:00:00 2001 From: Balaji Veeramani Date: Thu, 31 Aug 2023 12:53:57 -0500 Subject: [PATCH] [CI] Enforce Vale on Data documentation (#39029) Vale is a linter for writing style. This PR enforces Vale on the Data documentation. Signed-off-by: Balaji Veeramani --- .buildkite/lint.rayci.yml | 5 +++++ .vale.ini | 2 +- {.github => .vale}/styles/Google/AMPM.yml | 0 {.github => .vale}/styles/Google/Acronyms.yml | 2 +- {.github => .vale}/styles/Google/Colons.yml | 0 {.github => .vale}/styles/Google/Contractions.yml | 2 +- {.github => .vale}/styles/Google/DateFormat.yml | 0 {.github => .vale}/styles/Google/Ellipses.yml | 2 +- {.github => .vale}/styles/Google/EmDash.yml | 0 {.github => .vale}/styles/Google/EnDash.yml | 0 {.github => .vale}/styles/Google/Exclamation.yml | 0 {.github => .vale}/styles/Google/FirstPerson.yml | 2 +- {.github => .vale}/styles/Google/Gender.yml | 0 {.github => .vale}/styles/Google/GenderBias.yml | 0 {.github => .vale}/styles/Google/HeadingPunctuation.yml | 2 +- {.github => .vale}/styles/Google/Headings.yml | 2 +- {.github => .vale}/styles/Google/Latin.yml | 0 {.github => .vale}/styles/Google/LyHyphens.yml | 0 {.github => .vale}/styles/Google/OptionalPlurals.yml | 0 {.github => .vale}/styles/Google/Ordinal.yml | 0 {.github => .vale}/styles/Google/OxfordComma.yml | 2 +- {.github => .vale}/styles/Google/Parens.yml | 0 {.github => .vale}/styles/Google/Passive.yml | 0 {.github => .vale}/styles/Google/Periods.yml | 0 {.github => .vale}/styles/Google/Quotes.yml | 0 {.github => .vale}/styles/Google/Ranges.yml | 2 +- {.github => .vale}/styles/Google/Semicolons.yml | 0 {.github => .vale}/styles/Google/Slang.yml | 0 {.github => .vale}/styles/Google/Spacing.yml | 2 +- {.github => .vale}/styles/Google/Spelling.yml | 2 +- {.github => .vale}/styles/Google/Units.yml | 0 {.github => .vale}/styles/Google/We.yml | 2 +- {.github => .vale}/styles/Google/Will.yml | 2 +- {.github => .vale}/styles/Google/WordList.yml | 2 +- {.github => .vale}/styles/Google/meta.json | 0 {.github => .vale}/styles/Google/vocab.txt | 0 {.github => .vale}/styles/Vocab/Data/accept.txt | 1 + {.github => .vale}/styles/Vocab/General/accept.txt | 0 {.github => .vale}/styles/Vocab/General/reject.txt | 0 ci/lint/check-documentation-style.sh | 9 +++++++++ 40 files changed, 29 insertions(+), 14 deletions(-) rename {.github => .vale}/styles/Google/AMPM.yml (100%) rename {.github => .vale}/styles/Google/Acronyms.yml (98%) rename {.github => .vale}/styles/Google/Colons.yml (100%) rename {.github => .vale}/styles/Google/Contractions.yml (97%) rename {.github => .vale}/styles/Google/DateFormat.yml (100%) rename {.github => .vale}/styles/Google/Ellipses.yml (92%) rename {.github => .vale}/styles/Google/EmDash.yml (100%) rename {.github => .vale}/styles/Google/EnDash.yml (100%) rename {.github => .vale}/styles/Google/Exclamation.yml (100%) rename {.github => .vale}/styles/Google/FirstPerson.yml (94%) rename {.github => .vale}/styles/Google/Gender.yml (100%) rename {.github => .vale}/styles/Google/GenderBias.yml (100%) rename {.github => .vale}/styles/Google/HeadingPunctuation.yml (94%) rename {.github => .vale}/styles/Google/Headings.yml (96%) rename {.github => .vale}/styles/Google/Latin.yml (100%) rename {.github => .vale}/styles/Google/LyHyphens.yml (100%) rename {.github => .vale}/styles/Google/OptionalPlurals.yml (100%) rename {.github => .vale}/styles/Google/Ordinal.yml (100%) rename {.github => .vale}/styles/Google/OxfordComma.yml (92%) rename {.github => .vale}/styles/Google/Parens.yml (100%) rename {.github => .vale}/styles/Google/Passive.yml (100%) rename {.github => .vale}/styles/Google/Periods.yml (100%) rename {.github => .vale}/styles/Google/Quotes.yml (100%) rename {.github => .vale}/styles/Google/Ranges.yml (93%) rename {.github => .vale}/styles/Google/Semicolons.yml (100%) rename {.github => .vale}/styles/Google/Slang.yml (100%) rename {.github => .vale}/styles/Google/Spacing.yml (93%) rename {.github => .vale}/styles/Google/Spelling.yml (93%) rename {.github => .vale}/styles/Google/Units.yml (100%) rename {.github => .vale}/styles/Google/We.yml (93%) rename {.github => .vale}/styles/Google/Will.yml (90%) rename {.github => .vale}/styles/Google/WordList.yml (99%) rename {.github => .vale}/styles/Google/meta.json (100%) rename {.github => .vale}/styles/Google/vocab.txt (100%) rename {.github => .vale}/styles/Vocab/Data/accept.txt (92%) rename {.github => .vale}/styles/Vocab/General/accept.txt (100%) rename {.github => .vale}/styles/Vocab/General/reject.txt (100%) create mode 100755 ci/lint/check-documentation-style.sh diff --git a/.buildkite/lint.rayci.yml b/.buildkite/lint.rayci.yml index 49a0e8b89f920..b0f81bab31748 100644 --- a/.buildkite/lint.rayci.yml +++ b/.buildkite/lint.rayci.yml @@ -67,3 +67,8 @@ steps: - RAY_DISABLE_EXTRA_CPP=1 pip install -e python/[all] - ./ci/lint/check_api_annotations.py depends_on: forge + + - label: ":lint-roller: lint: documentation style" + commands: + - ./ci/lint/check-documentation-style.sh + depends_on: forge diff --git a/.vale.ini b/.vale.ini index 14c01c4dbf5e4..7dd4520a2c6c3 100644 --- a/.vale.ini +++ b/.vale.ini @@ -1,4 +1,4 @@ -StylesPath = .github/styles +StylesPath = .vale/styles Vocab = General, Data diff --git a/.github/styles/Google/AMPM.yml b/.vale/styles/Google/AMPM.yml similarity index 100% rename from .github/styles/Google/AMPM.yml rename to .vale/styles/Google/AMPM.yml diff --git a/.github/styles/Google/Acronyms.yml b/.vale/styles/Google/Acronyms.yml similarity index 98% rename from .github/styles/Google/Acronyms.yml rename to .vale/styles/Google/Acronyms.yml index 695bb5864f2c9..03b3f5b11a662 100644 --- a/.github/styles/Google/Acronyms.yml +++ b/.vale/styles/Google/Acronyms.yml @@ -1,7 +1,7 @@ extends: conditional message: "Spell out '%s', if it's unfamiliar to the audience." link: 'https://developers.google.com/style/abbreviations' -level: warning +level: error ignorecase: false # Ensures that the existence of 'first' implies the existence of 'second'. first: '\b([A-Z]{3,5})\b' diff --git a/.github/styles/Google/Colons.yml b/.vale/styles/Google/Colons.yml similarity index 100% rename from .github/styles/Google/Colons.yml rename to .vale/styles/Google/Colons.yml diff --git a/.github/styles/Google/Contractions.yml b/.vale/styles/Google/Contractions.yml similarity index 97% rename from .github/styles/Google/Contractions.yml rename to .vale/styles/Google/Contractions.yml index 07a604d4e8378..0c79d7be39ad8 100644 --- a/.github/styles/Google/Contractions.yml +++ b/.vale/styles/Google/Contractions.yml @@ -1,7 +1,7 @@ extends: substitution message: "Use '%s' instead of '%s'." link: 'https://developers.google.com/style/contractions' -level: warning +level: error ignorecase: true action: name: replace diff --git a/.github/styles/Google/DateFormat.yml b/.vale/styles/Google/DateFormat.yml similarity index 100% rename from .github/styles/Google/DateFormat.yml rename to .vale/styles/Google/DateFormat.yml diff --git a/.github/styles/Google/Ellipses.yml b/.vale/styles/Google/Ellipses.yml similarity index 92% rename from .github/styles/Google/Ellipses.yml rename to .vale/styles/Google/Ellipses.yml index 1e070517bfe4c..4f483f2f3785a 100644 --- a/.github/styles/Google/Ellipses.yml +++ b/.vale/styles/Google/Ellipses.yml @@ -2,7 +2,7 @@ extends: existence message: "In general, don't use an ellipsis." link: 'https://developers.google.com/style/ellipses' nonword: true -level: warning +level: error action: name: remove tokens: diff --git a/.github/styles/Google/EmDash.yml b/.vale/styles/Google/EmDash.yml similarity index 100% rename from .github/styles/Google/EmDash.yml rename to .vale/styles/Google/EmDash.yml diff --git a/.github/styles/Google/EnDash.yml b/.vale/styles/Google/EnDash.yml similarity index 100% rename from .github/styles/Google/EnDash.yml rename to .vale/styles/Google/EnDash.yml diff --git a/.github/styles/Google/Exclamation.yml b/.vale/styles/Google/Exclamation.yml similarity index 100% rename from .github/styles/Google/Exclamation.yml rename to .vale/styles/Google/Exclamation.yml diff --git a/.github/styles/Google/FirstPerson.yml b/.vale/styles/Google/FirstPerson.yml similarity index 94% rename from .github/styles/Google/FirstPerson.yml rename to .vale/styles/Google/FirstPerson.yml index 0b7b8828ca5f4..00f9c4bf1674a 100644 --- a/.github/styles/Google/FirstPerson.yml +++ b/.vale/styles/Google/FirstPerson.yml @@ -2,7 +2,7 @@ extends: existence message: "Avoid first-person pronouns such as '%s'." link: 'https://developers.google.com/style/pronouns#personal-pronouns' ignorecase: true -level: warning +level: error nonword: true tokens: - (?:^|\s)I\s diff --git a/.github/styles/Google/Gender.yml b/.vale/styles/Google/Gender.yml similarity index 100% rename from .github/styles/Google/Gender.yml rename to .vale/styles/Google/Gender.yml diff --git a/.github/styles/Google/GenderBias.yml b/.vale/styles/Google/GenderBias.yml similarity index 100% rename from .github/styles/Google/GenderBias.yml rename to .vale/styles/Google/GenderBias.yml diff --git a/.github/styles/Google/HeadingPunctuation.yml b/.vale/styles/Google/HeadingPunctuation.yml similarity index 94% rename from .github/styles/Google/HeadingPunctuation.yml rename to .vale/styles/Google/HeadingPunctuation.yml index b538be5b42a2e..bd83308098fe8 100644 --- a/.github/styles/Google/HeadingPunctuation.yml +++ b/.vale/styles/Google/HeadingPunctuation.yml @@ -2,7 +2,7 @@ extends: existence message: "Don't put a period at the end of a heading." link: 'https://developers.google.com/style/capitalization#capitalization-in-titles-and-headings' nonword: true -level: warning +level: error scope: heading action: name: edit diff --git a/.github/styles/Google/Headings.yml b/.vale/styles/Google/Headings.yml similarity index 96% rename from .github/styles/Google/Headings.yml rename to .vale/styles/Google/Headings.yml index a53301338a47c..929db4d8bbe10 100644 --- a/.github/styles/Google/Headings.yml +++ b/.vale/styles/Google/Headings.yml @@ -1,7 +1,7 @@ extends: capitalization message: "'%s' should use sentence-style capitalization." link: 'https://developers.google.com/style/capitalization#capitalization-in-titles-and-headings' -level: warning +level: error scope: heading match: $sentence indicators: diff --git a/.github/styles/Google/Latin.yml b/.vale/styles/Google/Latin.yml similarity index 100% rename from .github/styles/Google/Latin.yml rename to .vale/styles/Google/Latin.yml diff --git a/.github/styles/Google/LyHyphens.yml b/.vale/styles/Google/LyHyphens.yml similarity index 100% rename from .github/styles/Google/LyHyphens.yml rename to .vale/styles/Google/LyHyphens.yml diff --git a/.github/styles/Google/OptionalPlurals.yml b/.vale/styles/Google/OptionalPlurals.yml similarity index 100% rename from .github/styles/Google/OptionalPlurals.yml rename to .vale/styles/Google/OptionalPlurals.yml diff --git a/.github/styles/Google/Ordinal.yml b/.vale/styles/Google/Ordinal.yml similarity index 100% rename from .github/styles/Google/Ordinal.yml rename to .vale/styles/Google/Ordinal.yml diff --git a/.github/styles/Google/OxfordComma.yml b/.vale/styles/Google/OxfordComma.yml similarity index 92% rename from .github/styles/Google/OxfordComma.yml rename to .vale/styles/Google/OxfordComma.yml index b9ba21ebb25ab..36aca98ddcb1b 100644 --- a/.github/styles/Google/OxfordComma.yml +++ b/.vale/styles/Google/OxfordComma.yml @@ -2,6 +2,6 @@ extends: existence message: "Use the Oxford comma in '%s'." link: 'https://developers.google.com/style/commas' scope: sentence -level: warning +level: error tokens: - '(?:[^,]+,){1,}\s\w+\s(?:and|or)' diff --git a/.github/styles/Google/Parens.yml b/.vale/styles/Google/Parens.yml similarity index 100% rename from .github/styles/Google/Parens.yml rename to .vale/styles/Google/Parens.yml diff --git a/.github/styles/Google/Passive.yml b/.vale/styles/Google/Passive.yml similarity index 100% rename from .github/styles/Google/Passive.yml rename to .vale/styles/Google/Passive.yml diff --git a/.github/styles/Google/Periods.yml b/.vale/styles/Google/Periods.yml similarity index 100% rename from .github/styles/Google/Periods.yml rename to .vale/styles/Google/Periods.yml diff --git a/.github/styles/Google/Quotes.yml b/.vale/styles/Google/Quotes.yml similarity index 100% rename from .github/styles/Google/Quotes.yml rename to .vale/styles/Google/Quotes.yml diff --git a/.github/styles/Google/Ranges.yml b/.vale/styles/Google/Ranges.yml similarity index 93% rename from .github/styles/Google/Ranges.yml rename to .vale/styles/Google/Ranges.yml index 3ec045e777d9e..30fb25d22d96f 100644 --- a/.github/styles/Google/Ranges.yml +++ b/.vale/styles/Google/Ranges.yml @@ -2,6 +2,6 @@ extends: existence message: "Don't add words such as 'from' or 'between' to describe a range of numbers." link: 'https://developers.google.com/style/hyphens' nonword: true -level: warning +level: error tokens: - '(?:from|between)\s\d+\s?-\s?\d+' diff --git a/.github/styles/Google/Semicolons.yml b/.vale/styles/Google/Semicolons.yml similarity index 100% rename from .github/styles/Google/Semicolons.yml rename to .vale/styles/Google/Semicolons.yml diff --git a/.github/styles/Google/Slang.yml b/.vale/styles/Google/Slang.yml similarity index 100% rename from .github/styles/Google/Slang.yml rename to .vale/styles/Google/Slang.yml diff --git a/.github/styles/Google/Spacing.yml b/.vale/styles/Google/Spacing.yml similarity index 93% rename from .github/styles/Google/Spacing.yml rename to .vale/styles/Google/Spacing.yml index b430011c2ca5b..66e45a6b72a95 100644 --- a/.github/styles/Google/Spacing.yml +++ b/.vale/styles/Google/Spacing.yml @@ -1,7 +1,7 @@ extends: existence message: "'%s' should have one space." link: 'https://developers.google.com/style/sentence-spacing' -level: warning +level: error nonword: true action: name: remove diff --git a/.github/styles/Google/Spelling.yml b/.vale/styles/Google/Spelling.yml similarity index 93% rename from .github/styles/Google/Spelling.yml rename to .vale/styles/Google/Spelling.yml index 527ac07d318cb..aa9c48a71d04a 100644 --- a/.github/styles/Google/Spelling.yml +++ b/.vale/styles/Google/Spelling.yml @@ -2,7 +2,7 @@ extends: existence message: "In general, use American spelling instead of '%s'." link: 'https://developers.google.com/style/spelling' ignorecase: true -level: warning +level: error tokens: - '(?:\w+)nised?' - 'colour' diff --git a/.github/styles/Google/Units.yml b/.vale/styles/Google/Units.yml similarity index 100% rename from .github/styles/Google/Units.yml rename to .vale/styles/Google/Units.yml diff --git a/.github/styles/Google/We.yml b/.vale/styles/Google/We.yml similarity index 93% rename from .github/styles/Google/We.yml rename to .vale/styles/Google/We.yml index c7ac7d36221d5..872605407a109 100644 --- a/.github/styles/Google/We.yml +++ b/.vale/styles/Google/We.yml @@ -1,7 +1,7 @@ extends: existence message: "Try to avoid using first-person plural like '%s'." link: 'https://developers.google.com/style/pronouns#personal-pronouns' -level: warning +level: error ignorecase: true tokens: - we diff --git a/.github/styles/Google/Will.yml b/.vale/styles/Google/Will.yml similarity index 90% rename from .github/styles/Google/Will.yml rename to .vale/styles/Google/Will.yml index 20f6bc55294da..3a792e77c753d 100644 --- a/.github/styles/Google/Will.yml +++ b/.vale/styles/Google/Will.yml @@ -2,7 +2,7 @@ extends: existence message: "Avoid using '%s'." link: 'https://developers.google.com/style/tense' ignorecase: true -level: warning +level: error tokens: - will - "'ll" diff --git a/.github/styles/Google/WordList.yml b/.vale/styles/Google/WordList.yml similarity index 99% rename from .github/styles/Google/WordList.yml rename to .vale/styles/Google/WordList.yml index 1b502744ec339..f39e86882e102 100644 --- a/.github/styles/Google/WordList.yml +++ b/.vale/styles/Google/WordList.yml @@ -1,7 +1,7 @@ extends: substitution message: "Use '%s' instead of '%s'." link: "https://developers.google.com/style/word-list" -level: warning +level: error ignorecase: false action: name: replace diff --git a/.github/styles/Google/meta.json b/.vale/styles/Google/meta.json similarity index 100% rename from .github/styles/Google/meta.json rename to .vale/styles/Google/meta.json diff --git a/.github/styles/Google/vocab.txt b/.vale/styles/Google/vocab.txt similarity index 100% rename from .github/styles/Google/vocab.txt rename to .vale/styles/Google/vocab.txt diff --git a/.github/styles/Vocab/Data/accept.txt b/.vale/styles/Vocab/Data/accept.txt similarity index 92% rename from .github/styles/Vocab/Data/accept.txt rename to .vale/styles/Vocab/Data/accept.txt index e612b3460d46f..0a22daeaf6057 100644 --- a/.github/styles/Vocab/Data/accept.txt +++ b/.vale/styles/Vocab/Data/accept.txt @@ -6,6 +6,7 @@ Spotify('s)? TFRecord(s)? UDF(s)? [Dd]atasource +[Dd]iscretizer(s)? [Gg]roupby [Ii]ndexable [Ii]ngest diff --git a/.github/styles/Vocab/General/accept.txt b/.vale/styles/Vocab/General/accept.txt similarity index 100% rename from .github/styles/Vocab/General/accept.txt rename to .vale/styles/Vocab/General/accept.txt diff --git a/.github/styles/Vocab/General/reject.txt b/.vale/styles/Vocab/General/reject.txt similarity index 100% rename from .github/styles/Vocab/General/reject.txt rename to .vale/styles/Vocab/General/reject.txt diff --git a/ci/lint/check-documentation-style.sh b/ci/lint/check-documentation-style.sh new file mode 100755 index 0000000000000..92c7ea476560e --- /dev/null +++ b/ci/lint/check-documentation-style.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +VALE_BIN=$(mktemp -d) +wget https://github.com/errata-ai/vale/releases/download/v2.28.0/vale_2.28.0_Linux_64-bit.tar.gz -P "$VALE_BIN" +tar -xvzf "$VALE_BIN"/vale_2.28.0_Linux_64-bit.tar.gz -C "$VALE_BIN" vale +"$VALE_BIN"/vale doc/source/data +rm -rf "$VALE_BIN"