From d110702a6031d5e6244a862581a4d326e8d5514a Mon Sep 17 00:00:00 2001 From: kodster28 Date: Thu, 22 Aug 2024 12:54:39 -0500 Subject: [PATCH 1/7] [Chore] Reset Vale --- .github/styles/cloudflare/Contractions.yml | 57 +++++++++++++++++++ .github/styles/cloudflare/LatinTerms.yml | 18 ++++++ .github/styles/cloudflare/ShellCodeBlocks.yml | 47 --------------- .vale.ini | 4 +- 4 files changed, 77 insertions(+), 49 deletions(-) create mode 100644 .github/styles/cloudflare/Contractions.yml create mode 100644 .github/styles/cloudflare/LatinTerms.yml delete mode 100644 .github/styles/cloudflare/ShellCodeBlocks.yml diff --git a/.github/styles/cloudflare/Contractions.yml b/.github/styles/cloudflare/Contractions.yml new file mode 100644 index 00000000000000..3e6d40619e2b56 --- /dev/null +++ b/.github/styles/cloudflare/Contractions.yml @@ -0,0 +1,57 @@ +--- +# Warning: cloudflare.Contractsion +# +# Suggests alternatives for common contractions. +# +# For a list of all options, see https://vale.sh/docs/topics/styles/ + +extends: substitution +message: "Use '%s' instead of '%s'." +link: https://developers.cloudflare.com/style-guide/grammar/parts-of-speech/contractions/ +level: error +ignorecase: true +action: + name: replace +swap: + are not: aren't + cannot: can't + could not: couldn't + did not: didn't + do not: don't + does not: doesn't + has not: hasn't + have not: haven't + how is: how's + is not: isn't + + 'it is(?!\.)': it's + 'it''s(?=\.)': it is + + should not: shouldn't + + "that is(?![.,])": that's + 'that''s(?=\.)': that is + + 'they are(?!\.)': they're + 'they''re(?=\.)': they are + + was not: wasn't + + 'we are(?!\.)': we're + 'we''re(?=\.)': we are + + 'we have(?!\.)': we've + 'we''ve(?=\.)': we have + + were not: weren't + + 'what is(?!\.)': what's + 'what''s(?=\.)': what is + + 'when is(?!\.)': when's + 'when''s(?=\.)': when is + + 'where is(?!\.)': where's + 'where''s(?=\.)': where is + + will not: won't diff --git a/.github/styles/cloudflare/LatinTerms.yml b/.github/styles/cloudflare/LatinTerms.yml new file mode 100644 index 00000000000000..21d1ad90f44d2b --- /dev/null +++ b/.github/styles/cloudflare/LatinTerms.yml @@ -0,0 +1,18 @@ +--- +# Warning: cloudflare.LatinTerms +# +# Checks for use of Latin terms. +# Uses https://github.com/errata-ai/Google/blob/master/Google/Latin.yml for ideas. +# +# For a list of all options, see https://vale.sh/docs/topics/styles/ + +extends: substitution +message: "Use '%s' instead of '%s', but consider rewriting the sentence." +link: https://developers.cloudflare.com/style-guide/grammar/parts-of-speech/abbreviations/#ie-vs-eg +level: warning +nonword: true +ignorecase: true +swap: + '\b(?:e\.?g[\s.,;:])': for example + '\b(?:i\.?e[\s.,;:])': that is + '\bvia\b': "with', 'through', or 'by using" diff --git a/.github/styles/cloudflare/ShellCodeBlocks.yml b/.github/styles/cloudflare/ShellCodeBlocks.yml deleted file mode 100644 index 86a68884935740..00000000000000 --- a/.github/styles/cloudflare/ShellCodeBlocks.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -# Warning: cloudflare.ShellCodeBlocks -# -# Checks that all `sh` codeblocks contain at least one `$`, to indicate a command. -# -# For a list of all options, see https://vale.sh/docs/topics/styles/ -extends: script -message: "**Warning**: `sh` codeblocks must include a `$` character at the beginning of a command, otherwise it can't be copied. If this is a multi-line codeblock, please use the `bash` language. For more information, refer to [Code block guidelines](https://developers.cloudflare.com/style-guide/formatting/code-block-guidelines/)" -level: warning -scope: raw -script: | - text := import("text") - matches := [] - - open := false - closed := false - dollar := false - blockText := [] - - reset := func() { - open = false - closed = false - dollar = false - blockText = [] - } - - for line in text.split(scope, "\n") { - trimmed := text.trim_space(line) - - if !open && trimmed == "```sh" { open = true } - - if open { - blockText = append(blockText, line) - if !dollar && text.contains(trimmed, "$ ") { dollar = true } - if !closed && trimmed == "```" { closed = true } - } - - if open && closed { - if !dollar { - block := text.join(blockText, "\n") - start := text.index(scope, block) - matches = append(matches, { begin: start, end: start + len(block) }) - } - - reset() - } - } \ No newline at end of file diff --git a/.vale.ini b/.vale.ini index 707c1420bf2335..a11fda29007694 100644 --- a/.vale.ini +++ b/.vale.ini @@ -4,9 +4,9 @@ MinAlertLevel = suggestion [formats] yml = yaml -[*.md] +[*.mdx] BasedOnStyles = cloudflare -BlockIgnores = (?s) *({{< ?code-block [^>]* >}}.*?{{< ?/ ?code-block >}}) +BlockIgnores = (?s) *({.*?}) [*.yaml] BasedOnStyles = cloudflare \ No newline at end of file From 1e0e702ebef6d55764c78b9dd05c9fbacf926bc1 Mon Sep 17 00:00:00 2001 From: kodster28 Date: Thu, 22 Aug 2024 12:56:22 -0500 Subject: [PATCH 2/7] update config --- .vale.ini | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.vale.ini b/.vale.ini index a11fda29007694..9d449efeeea4fd 100644 --- a/.vale.ini +++ b/.vale.ini @@ -1,12 +1,18 @@ StylesPath = .github/styles MinAlertLevel = suggestion +[*] +IgnoredScopes = code, tt, img, url, a +SkippedScopes = script, style, pre, figure, code +# Ignore code surrounded by backticks or plus sign, parameters defaults, URLs, and angle brackets. +TokenIgnores = (<\/?[A-Z].+>), (\x60[^\n\x60]+\x60), ([^\n]+=[^\n]*), (\+[^\n]+\+), (http[^\n]+\[) + [formats] yml = yaml +mdx = md -[*.mdx] +[*.md] BasedOnStyles = cloudflare -BlockIgnores = (?s) *({.*?}) [*.yaml] BasedOnStyles = cloudflare \ No newline at end of file From 6a58624c2945cfcd18e5b16ea5c316f3eb2f2959 Mon Sep 17 00:00:00 2001 From: kodster28 Date: Thu, 22 Aug 2024 15:56:01 -0500 Subject: [PATCH 3/7] re-order --- .vale.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.vale.ini b/.vale.ini index 9d449efeeea4fd..3ee7151be7d7b5 100644 --- a/.vale.ini +++ b/.vale.ini @@ -1,16 +1,16 @@ StylesPath = .github/styles MinAlertLevel = suggestion - -[*] IgnoredScopes = code, tt, img, url, a SkippedScopes = script, style, pre, figure, code -# Ignore code surrounded by backticks or plus sign, parameters defaults, URLs, and angle brackets. -TokenIgnores = (<\/?[A-Z].+>), (\x60[^\n\x60]+\x60), ([^\n]+=[^\n]*), (\+[^\n]+\+), (http[^\n]+\[) [formats] yml = yaml mdx = md +[*] +# Ignore code surrounded by backticks or plus sign, parameters defaults, URLs, and angle brackets. +TokenIgnores = (<\/?[A-Z].+>), (\x60[^\n\x60]+\x60), ([^\n]+=[^\n]*), (\+[^\n]+\+), (http[^\n]+\[) + [*.md] BasedOnStyles = cloudflare From 342fd852064822ffe446a6dbe50e9b0f06195b1f Mon Sep 17 00:00:00 2001 From: kodster28 Date: Fri, 23 Aug 2024 07:35:52 -0500 Subject: [PATCH 4/7] Added test value --- .vale.ini | 2 +- src/content/docs/rules/page-rules/index.mdx | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.vale.ini b/.vale.ini index 3ee7151be7d7b5..dc974ee077dbda 100644 --- a/.vale.ini +++ b/.vale.ini @@ -9,7 +9,7 @@ mdx = md [*] # Ignore code surrounded by backticks or plus sign, parameters defaults, URLs, and angle brackets. -TokenIgnores = (<\/?[A-Z].+>), (\x60[^\n\x60]+\x60), ([^\n]+=[^\n]*), (\+[^\n]+\+), (http[^\n]+\[) +TokenIgnores = (<\/?[A-Z].+>), (\x60[^\n\x60]+\x60), ([^\n]+=[^\n]*), (\+[^\n]+\+), (http[^\n]+\[), (https[^\n]+\[) [*.md] BasedOnStyles = cloudflare diff --git a/src/content/docs/rules/page-rules/index.mdx b/src/content/docs/rules/page-rules/index.mdx index 284c246f5b7e8a..aa9bec5d1f24eb 100644 --- a/src/content/docs/rules/page-rules/index.mdx +++ b/src/content/docs/rules/page-rules/index.mdx @@ -4,20 +4,23 @@ source: https://support.cloudflare.com/hc/en-us/articles/218411427-What-do-the-c title: Page Rules sidebar: order: 10 - --- -import { FeatureTable } from "~/components" +import { FeatureTable } from "~/components"; Page rules trigger one or more actions whenever a certain URL pattern is matched. Page Rules are available in **Rules** > **Page Rules**. +Then I went to the store, e.g., HEB. + +We can't do that. + ## Availability The default number of allowed page rules depends on the domain plan as shown below. -*** +--- ## Before getting started @@ -39,9 +42,9 @@ Cloudflare recommends only using reserved IP addresses or domain names to avoid For more information on reserved IP addresses or top level domains, please refer to these RFCs: -* [RFC 5737](https://datatracker.ietf.org/doc/html/rfc5737) -* [RFC 3849](https://datatracker.ietf.org/doc/html/rfc3849) -* [RFC 2606](https://datatracker.ietf.org/doc/html/rfc2606) +- [RFC 5737](https://datatracker.ietf.org/doc/html/rfc5737) +- [RFC 3849](https://datatracker.ietf.org/doc/html/rfc3849) +- [RFC 2606](https://datatracker.ietf.org/doc/html/rfc2606) ### Priority order matters @@ -67,6 +70,6 @@ The `` and `` segments are optional. If omitted, `` matche When a page rule is disabled, actions will not trigger, but the rule will: -* Still appear in the Cloudflare dashboard. -* Be editable. -* Count against the number of rules allowed for your domain. +- Still appear in the Cloudflare dashboard. +- Be editable. +- Count against the number of rules allowed for your domain. From 3d0829177231f2965897a4c22d8a21f37034efc4 Mon Sep 17 00:00:00 2001 From: kodster28 Date: Fri, 23 Aug 2024 07:41:43 -0500 Subject: [PATCH 5/7] removed contractions b/c that's actually flipped --- .github/styles/cloudflare/Contractions.yml | 57 --------------------- .github/styles/cloudflare/RelativeLinks.yml | 4 +- src/content/docs/rules/page-rules/index.mdx | 4 -- 3 files changed, 2 insertions(+), 63 deletions(-) delete mode 100644 .github/styles/cloudflare/Contractions.yml diff --git a/.github/styles/cloudflare/Contractions.yml b/.github/styles/cloudflare/Contractions.yml deleted file mode 100644 index 3e6d40619e2b56..00000000000000 --- a/.github/styles/cloudflare/Contractions.yml +++ /dev/null @@ -1,57 +0,0 @@ ---- -# Warning: cloudflare.Contractsion -# -# Suggests alternatives for common contractions. -# -# For a list of all options, see https://vale.sh/docs/topics/styles/ - -extends: substitution -message: "Use '%s' instead of '%s'." -link: https://developers.cloudflare.com/style-guide/grammar/parts-of-speech/contractions/ -level: error -ignorecase: true -action: - name: replace -swap: - are not: aren't - cannot: can't - could not: couldn't - did not: didn't - do not: don't - does not: doesn't - has not: hasn't - have not: haven't - how is: how's - is not: isn't - - 'it is(?!\.)': it's - 'it''s(?=\.)': it is - - should not: shouldn't - - "that is(?![.,])": that's - 'that''s(?=\.)': that is - - 'they are(?!\.)': they're - 'they''re(?=\.)': they are - - was not: wasn't - - 'we are(?!\.)': we're - 'we''re(?=\.)': we are - - 'we have(?!\.)': we've - 'we''ve(?=\.)': we have - - were not: weren't - - 'what is(?!\.)': what's - 'what''s(?=\.)': what is - - 'when is(?!\.)': when's - 'when''s(?=\.)': when is - - 'where is(?!\.)': where's - 'where''s(?=\.)': where is - - will not: won't diff --git a/.github/styles/cloudflare/RelativeLinks.yml b/.github/styles/cloudflare/RelativeLinks.yml index 20a37d613e5c31..683d39bb40007a 100644 --- a/.github/styles/cloudflare/RelativeLinks.yml +++ b/.github/styles/cloudflare/RelativeLinks.yml @@ -5,8 +5,8 @@ # # For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence -message: "**Error**: When referring to another page in our docs, use the full relative link (`/1.1.1.1/check/`) instead of the full URL (`https://developers.cloudflare.com/1.1.1.1/check/`)." -level: error +message: "**Warning**: When referring to another page in our docs, use the full relative link (`/1.1.1.1/check/`) instead of the full URL (`https://developers.cloudflare.com/1.1.1.1/check/`)." +level: warning scope: raw raw: - '\[.+\]\(https?:\/\/developers\.cloudflare\.com\/.+\)' diff --git a/src/content/docs/rules/page-rules/index.mdx b/src/content/docs/rules/page-rules/index.mdx index aa9bec5d1f24eb..517533fbfbdaff 100644 --- a/src/content/docs/rules/page-rules/index.mdx +++ b/src/content/docs/rules/page-rules/index.mdx @@ -10,10 +10,6 @@ import { FeatureTable } from "~/components"; Page rules trigger one or more actions whenever a certain URL pattern is matched. Page Rules are available in **Rules** > **Page Rules**. -Then I went to the store, e.g., HEB. - -We can't do that. - ## Availability The default number of allowed page rules depends on the domain plan as shown below. From 7774c45e24799acaa0a8809e506de1d923d29ceb Mon Sep 17 00:00:00 2001 From: kodster28 Date: Fri, 23 Aug 2024 07:43:48 -0500 Subject: [PATCH 6/7] remove style guide workflow --- .github/workflows/vale.yml | 38 --------------------- src/content/docs/rules/page-rules/index.mdx | 4 +++ 2 files changed, 4 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/vale.yml diff --git a/.github/workflows/vale.yml b/.github/workflows/vale.yml deleted file mode 100644 index 58eaeb05ec75df..00000000000000 --- a/.github/workflows/vale.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Style guide -on: - pull_request: - types: - - opened - - synchronize - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - review: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Get Changed Files from Pull Request - if: ${{ !cancelled() }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # get file names and structure as JSON - files=$(gh api /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files -q '.[] | select(.status != "removed") | .filename | select(test("(.yaml|yml|md)$"))') - filesArray="[$(echo "$files" | sed -e 's/^/"/' -e 's/$/"/' -e 's/ /", "/g' | tr '\n' , | sed 's/,$//')]" - echo "CHANGED_FILES=$filesArray" >> "$GITHUB_ENV" - - - name: Output Changed Files - run: echo ${{ env.CHANGED_FILES }} - - - name: Vale - uses: errata-ai/vale-action@reviewdog - if: ${{ !cancelled() }} - with: - files: ${{ env.CHANGED_FILES }} - reporter: github-pr-review - filter_mode: diff_context diff --git a/src/content/docs/rules/page-rules/index.mdx b/src/content/docs/rules/page-rules/index.mdx index 517533fbfbdaff..0d64cf64716e52 100644 --- a/src/content/docs/rules/page-rules/index.mdx +++ b/src/content/docs/rules/page-rules/index.mdx @@ -10,6 +10,8 @@ import { FeatureTable } from "~/components"; Page rules trigger one or more actions whenever a certain URL pattern is matched. Page Rules are available in **Rules** > **Page Rules**. +Let's go to [this page](/workers/). + ## Availability The default number of allowed page rules depends on the domain plan as shown below. @@ -22,6 +24,8 @@ The default number of allowed page rules depends on the domain plan as shown bel It is important to understand a few Page Rules behaviors. +Help me get to the store, i.e., the place with bagels. + ### Page Rules require proxied DNS records Page Rules require a [proxied](/dns/manage-dns-records/reference/proxied-dns-records/) DNS record for your page rule to work. Page Rules will not apply to hostnames that do not exist in DNS or are not being directed to Cloudflare. From 3d99990c3cb72098b0c43db7955d20793222ab34 Mon Sep 17 00:00:00 2001 From: kodster28 Date: Fri, 23 Aug 2024 07:58:45 -0500 Subject: [PATCH 7/7] remove testing --- src/content/docs/rules/page-rules/index.mdx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/content/docs/rules/page-rules/index.mdx b/src/content/docs/rules/page-rules/index.mdx index 0d64cf64716e52..517533fbfbdaff 100644 --- a/src/content/docs/rules/page-rules/index.mdx +++ b/src/content/docs/rules/page-rules/index.mdx @@ -10,8 +10,6 @@ import { FeatureTable } from "~/components"; Page rules trigger one or more actions whenever a certain URL pattern is matched. Page Rules are available in **Rules** > **Page Rules**. -Let's go to [this page](/workers/). - ## Availability The default number of allowed page rules depends on the domain plan as shown below. @@ -24,8 +22,6 @@ The default number of allowed page rules depends on the domain plan as shown bel It is important to understand a few Page Rules behaviors. -Help me get to the store, i.e., the place with bagels. - ### Page Rules require proxied DNS records Page Rules require a [proxied](/dns/manage-dns-records/reference/proxied-dns-records/) DNS record for your page rule to work. Page Rules will not apply to hostnames that do not exist in DNS or are not being directed to Cloudflare.