Skip to content

Commit

Permalink
Rework cspell to correctly cover the entire repository (#1514)
Browse files Browse the repository at this point in the history
Rework `cspell` triggers to accurately trigger based on files being changed.

Problem: In our current cspell workflow setup, any changes to files outside of `cli` and `ext/vscode` might potentially break our "cspell for templates" job, but not be validated as part of PR builds.

Solution:
1. Promote `./templates` as a project with it's own cspell job
2. Add a `cspell-misc` workflow that triggers for any file changes outside of cspell projects (which are covered by their own triggers), and does spell check on all miscellaneous files.
  • Loading branch information
weikanglim authored Feb 9, 2023
1 parent 0ba86fb commit dd55204
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cli-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v1
name: Run spell check for project and for azd
with:
node-version: "16"
- run: npm install -g cspell
- run: cspell lint '**/*.go' --config ./cli/azd/.vscode/cspell.yaml --root ./cli/azd --no-progress
- name: Spell check for CLI source code
run: cspell lint '**/*.go' --config ./cli/azd/.vscode/cspell.yaml --root ./cli/azd --no-progress

bicep-lint:
uses: ./.github/workflows/lint-bicep.yml
24 changes: 24 additions & 0 deletions .github/workflows/cspell-misc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: misc

on:
pull_request:
branches: [main]
paths-ignore:
# Changes here should be kept in-sync with projects listed in cspell.misc.yaml
- 'eng/**' # Not required
# Standalone projects that have their own cspell
- 'cli/**'
- 'ext/**'
- 'templates/**'

jobs:
cspell-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
- run: npm install -g cspell
- name: Spell check for general files
run: cspell lint '**/*' --config ./.vscode/cspell.misc.yaml --relative --no-progress
4 changes: 2 additions & 2 deletions .github/workflows/templates-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v1
name: Run spell check for templates
with:
node-version: "16"
- run: npm install -g cspell
- run: cspell lint '**/*' --config ./.vscode/cspell.yaml --relative --no-progress
- name: Spell check for templates
run: cspell lint '**/*' --config ./templates/cspell.yaml --root ./templates --no-progress
4 changes: 2 additions & 2 deletions .github/workflows/vscode-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v1
name: Run spell check azd vscode extension
with:
node-version: "16"
- run: npm install -g cspell
- run: cspell lint '**/*.ts' --config ./ext/vscode/.vscode/cspell.yaml --root ./ext/vscode --no-progress
- name: Spell check for vscode extension
run: cspell lint '**/*.ts' --config ./ext/vscode/.vscode/cspell.yaml --root ./ext/vscode --no-progress

build-test:
runs-on: ${{ matrix.os }}
Expand Down
1 change: 0 additions & 1 deletion .vscode/cspell.global.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ ignorePaths:
- ./go.mod
- ./go.sum
- ./NOTICE.txt
- ./templates/common/NOTICE.txt
words:
- opentelemetry
- bson
Expand Down
19 changes: 6 additions & 13 deletions .vscode/cspell.yaml → .vscode/cspell.misc.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

# cspell settings for top project (no cli)
# cspell settings for miscellaneous files thats are not covered by other projects.
# cspell root should be specified as the top-level repository directory.

# Use global config
import: cspell.global.yaml

ignorePaths:
# Project changes here should be kept in-sync workflow cspell-misc.yml
- cli # uses its own cspell config
- eng # not required
- ext # uses its own cspell config
- "*.bicep" # no need to lint resource files
- mvnw # Maven wrapper asset used in Java templates -- external library code
- mvnw.cmd # Maven wrapper asset used in Java templates -- external library code
dictionaryDefinitions:
- name: templatesDictionary
path: ./cspell-templates.txt
description: Custom Dictionary for templates
addWords: true
scope: workspace
dictionaries:
- templatesDictionary
- templates # uses its own cspell config

- eng # not required
overrides:
- filename: ./SECURITY.md
words:
Expand Down
File renamed without changes.
22 changes: 22 additions & 0 deletions templates/cspell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

# cspell settings for azd templates

ignorePaths:
- "*.bicep" # no need to lint resource files
- mvnw # Maven wrapper asset used in Java templates -- external library code
- mvnw.cmd # Maven wrapper asset used in Java templates -- external library code
- ./common/NOTICE.txt

# Use global config
import: ../.vscode/cspell.global.yaml

dictionaryDefinitions:
- name: templatesDictionary
path: ./cspell-templates.txt
description: Custom Dictionary for templates
addWords: true
scope: workspace
dictionaries:
- templatesDictionary

0 comments on commit dd55204

Please sign in to comment.