Skip to content

Commit a73e8e7

Browse files
CopilotzachcasperCopilot
authored
Add cspell spell check workflow for YAML and Markdown docs (#272)
## Summary Adds a cspell-based spell check that runs on every pull request, covering both Markdown files and the `description` fields embedded in resource type YAML schemas. Modeled after `radius-project/radius` and wired to the shared reusable workflow so config stays in sync across repos. - **Workflow** (`.github/workflows/spellcheck.yaml`): runs on PRs (+ manual dispatch), delegating to `radius-project/.github/.github/workflows/__spellcheck.yml@main`. Passes `glob: "**/*.{md,yaml,yml}"` — the key extension over radius, so embedded YAML `description` text is checked. A failing run posts a sticky PR comment listing failing words and linking `.cspellignore`. - **Config** (`.github/linters/.cspell.yml`): copied verbatim from `radius-project/.github` (retains the "synced / DO NOT EDIT" header) to preserve the cross-repo sync contract. Ignores URLs, code fences, HTML tags, markdown links, and `@mentions` to limit false positives. Per-repo behavior lives in the workflow `glob` + `.cspellignore`, not in this file. - **Dictionary** (`.cspellignore`, repo root): seeded from the shared Radius word list, keeping vocabulary aligned with the radius and docs repos — relevant because YAML `description` content here flows into docs-repo PRs. Adds repo-specific terms: `SLSA`, `tmpfs`, `gibibytes`/`gibibyte`, `PGDATA`, `MYSQLDB`, `appdb`, `vnet`, `rrttest`. - **Fix**: corrected `availabla` → `available` in `Compute/containers/containers.yaml` (the `emphemeral` typo referenced by the issue was already fixed). `cspell lint` passes with 0 issues across all 62 YAML/Markdown files. ## Reason for change Misspellings in embedded documentation (YAML `description` fields, READMEs) were merging undetected — e.g. `emphemeral` in `Compute/containers/containers.yaml` — degrading the quality of docs that users and downstream tooling depend on. There was no automated spell check. ## How to test 1. Open a PR; the **Spellcheck** workflow runs automatically. 2. Introduce a misspelling in any `*.md` or `*.yaml` file and confirm the workflow fails with a PR comment naming the word. 3. Add the word to `.cspellignore` and confirm the workflow passes. 4. Locally: `npm install -g cspell && cspell lint --config .github/linters/.cspell.yml --no-progress --dot "**/*.{md,yaml,yml}"`. ## File change summary | File | Summary of change | | ---- | ----------------- | | `.github/workflows/spellcheck.yaml` | New PR workflow calling the shared reusable spellcheck workflow with a `**/*.{md,yaml,yml}` glob. | | `.github/linters/.cspell.yml` | New cspell config synced verbatim from `radius-project/.github`, with ignore patterns for code/URLs/HTML/mentions. | | `.cspellignore` | New repo-root custom word list seeded from the shared Radius dictionary plus repo-specific terms. | | `Compute/containers/containers.yaml` | Fixed misspelling `availabla` → `available` in two TODO comments. | <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #271 --------- Signed-off-by: Zach Casper <zachcasper@microsoft.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Zach Casper <zachcasper@microsoft.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent c53feaf commit a73e8e7

4 files changed

Lines changed: 175 additions & 2 deletions

File tree

.cspellignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
appdb
2+
binfmt
3+
buildkitd
4+
Dapr
5+
Docsy
6+
gibibyte
7+
gibibytes
8+
gomod
9+
MYSQLDB
10+
oras
11+
ORAS
12+
PGDATA
13+
rrttest
14+
SLSA
15+
tmpfs
16+
vnet
17+
westus

.github/linters/.cspell.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
2+
# docs: https://cspell.org/docs/getting-started
3+
# ------------------------------------------------------------------------------
4+
# This file is synced from the radius-project/.github repository.
5+
# DO NOT EDIT MANUALLY - changes will be overwritten by the next sync.
6+
# Source: https://github.com/radius-project/.github
7+
# ------------------------------------------------------------------------------
8+
---
9+
$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
10+
version: "0.2"
11+
language: en
12+
13+
# Built-in dictionaries plus the shared custom word list (.cspellignore at repo root).
14+
# This is the unified Radius spell-checking configuration; per-repository custom
15+
# words belong in the repo's own .cspellignore file, not in this synced config.
16+
dictionaries:
17+
- softwareTerms
18+
- companies
19+
- python
20+
- bash
21+
- filetypes
22+
- en_US
23+
- cspellignore
24+
25+
# Ignore patterns within files (sections that should not be spell-checked).
26+
ignoreRegExpList:
27+
- code_block
28+
- adr_yaml_formatter
29+
- inline_code
30+
- tf_docs
31+
- md_link
32+
- url
33+
- at_mention
34+
- html_tag
35+
- email_address
36+
- hugo_shortcode
37+
- front_matter
38+
- html_code_tag
39+
40+
# Custom regex patterns so that fenced code, inline code, markdown links, URLs,
41+
# HTML and similar tokens are excluded from spell-checking.
42+
patterns:
43+
# Fenced code blocks: ```lang ... ``` (with or without language identifier).
44+
# Allows leading whitespace so indented code blocks inside list items match.
45+
- name: code_block
46+
pattern:
47+
- /^[ \t]*`{3,}[^\n]*\n[\s\S]*?^[ \t]*`{3,}\s*$/gm
48+
- name: adr_yaml_formatter
49+
pattern:
50+
- /(^([a-z-]*[:]{1})((\w|\s|,|"|-)*?)$)/gm
51+
# Inline code: `some code here`
52+
- name: inline_code
53+
pattern:
54+
- /`[^`\r\n]*`/g
55+
- name: tf_docs
56+
pattern:
57+
- ^(?:\s*\|{1}\s*)(?:<a name="(?:requirement|provider|module){1}_[\w]*"></a>){1}
58+
- \[.*\]\(#(?:requirement|provider|module){1}.*\)\s*
59+
- \|{1}\s*\[[\w_\.]*\]\(.*\)\s*\|\s(?:resource|data source)\s*\|
60+
- (?:\|\s*){1}(?:Azure\/avm){1}.*(?:\s*\|){1}
61+
# Markdown link / image targets: only the `](url)` portion is ignored so
62+
# typos in the visible link text or image alt text are still caught.
63+
# Matches both `[text](url)` and `![alt](url)` because we only skip the
64+
# parentheses payload.
65+
- name: md_link
66+
pattern:
67+
- /\]\([^)]*\)/g
68+
# URLs
69+
- name: url
70+
pattern:
71+
- /https?:\/\/[^\s)>]*/g
72+
# @mentions like @user or @team-name
73+
- name: at_mention
74+
pattern:
75+
- /(?<!\w)@[\w.-]+/g
76+
# HTML tags
77+
- name: html_tag
78+
pattern:
79+
- /<[^>]+>/g
80+
# Content between HTML <code>...</code> tags (used in tables that can't use markdown code fences)
81+
- name: html_code_tag
82+
pattern:
83+
- /<code>[\s\S]*?<\/code>/g
84+
# Email addresses
85+
- name: email_address
86+
pattern:
87+
- /[\w.+-]+@[\w.-]+\.[a-zA-Z]{2,}/g
88+
# Hugo / Docsy shortcodes: {{< rad file="..." >}} or {{% notice %}}
89+
- name: hugo_shortcode
90+
pattern:
91+
- /\{\{[%<][\s\S]*?[%>]\}\}/g
92+
# Hugo front matter: only skip non-rendered keys so user-facing fields
93+
# (title, description, linkTitle) are still spell-checked. The first
94+
# sub-pattern covers single-line `key: value` entries; the second covers
95+
# multi-line list values (e.g. `aliases:` followed by indented `- /path`
96+
# items); the third matches the `---` / `+++` delimiter lines.
97+
- name: front_matter
98+
pattern:
99+
- /^(?:type|weight|slug|url|no_list|manualLink|manualLinkTarget|category|categories|tags)\s*:[^\n]*$/gm
100+
- /^aliases\s*:[^\n]*(?:\n[ \t]+-[^\n]*)*/gm
101+
- /^(?:---|\+\+\+)\s*$/gm
102+
103+
# Use the shared .cspellignore file (at the repo root) as a custom dictionary.
104+
dictionaryDefinitions:
105+
- name: cspellignore
106+
path: ../../.cspellignore
107+
addWords: true
108+
109+
# Allow compound words to be checked as a single word
110+
# (e.g., "spellcheck" instead of "spell check").
111+
allowCompoundWords: true
112+
113+
# Paths that should not be spell-checked: vendored theme/modules, generated
114+
# Hugo output, dependency folders and the shared dictionary itself.
115+
# Patterns use the `**/` prefix because cspell resolves ignorePaths relative
116+
# to the config file location (.github/linters/). Entries that do not exist in
117+
# a given repository are simply no-ops, so this superset is safe to share.
118+
ignorePaths:
119+
- "**/node_modules/**"
120+
- "**/.dev/**"
121+
- "**/.venv/**"
122+
- "**/venv/**"
123+
- "**/.terraform/**"
124+
- "**/.cspellignore"
125+
- "**/themes/**"
126+
- "**/_vendor/**"
127+
- "**/public/**"
128+
- "**/resources/_gen/**"
129+
- "**/holding-pen/**"
130+
- "**/redirect/**"
131+
- "**/presentation-pack/**"
132+
133+
# Default to checking both Markdown and YAML. CI also passes an explicit glob.
134+
files:
135+
- "**/*.{md,yaml,yml}"

.github/workflows/spellcheck.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
2+
---
3+
name: Spellcheck
4+
5+
on:
6+
workflow_dispatch:
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
10+
permissions: {}
11+
12+
jobs:
13+
spellcheck:
14+
uses: radius-project/.github/.github/workflows/__spellcheck.yml@main
15+
permissions:
16+
contents: read
17+
pull-requests: write
18+
with:
19+
# Check both Markdown docs and the embedded `description` fields in
20+
# resource type YAML schemas (and other YAML docs in the repo).
21+
glob: "**/*.{md,yaml,yml}"

Compute/containers/containers.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ types:
168168
description: (Optional) Requests define the minimum amount of CPU or memory that is required by the container.
169169
properties:
170170
cpu:
171-
# TODO: Change to float once floats are availabla https://github.com/radius-project/radius/issues/10279
171+
# TODO: Change to float once floats are available https://github.com/radius-project/radius/issues/10279
172172
type: string
173173
description: (Optional) The minimum number of vCPUs required by the container. `0.1` results in one tenth of a vCPU being reserved.
174174
memoryInMib:
@@ -179,7 +179,7 @@ types:
179179
description: (Optional) Limits define the maximum amount of CPU or memory the container can consume.
180180
properties:
181181
cpu:
182-
# TODO: Change to float once floats are availabla https://github.com/radius-project/radius/issues/10279
182+
# TODO: Change to float once floats are available https://github.com/radius-project/radius/issues/10279
183183
type: string
184184
description: (Optional) The maximum number of vCPUs which can be used by the container.
185185
memoryInMib:

0 commit comments

Comments
 (0)