File: README.md

package info (click to toggle)
python-azure 20251104%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 770,224 kB
  • sloc: python: 6,357,217; ansic: 804; javascript: 287; makefile: 198; sh: 193; xml: 109
file content (84 lines) | stat: -rw-r--r-- 2,912 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Spelling Check Scripts

This directory contains a script to run cspell (Code Spell Checker) on the repository using the dependencies defined in the adjacent `package*.json` files.

## Adding Legitimate Words

If the spell checker flags legitimate words as misspelled, you can add them to the dictionary configuration file located at `.vscode/cspell.json`.

### Where to Add Words

There are two main places to add legitimate words. Maintain alphabetical order when adding words to keep the dictionary organized:

1. **Root-level words array**: Add words to the `"words"` array at the root level of the configuration file. This is the preferred location for project-specific terms, technical vocabulary, and commonly used words.

2. **Baseline dictionary**: Add words to the `"baseline"` dictionary under `"dictionaryDefinitions"`. This is typically used for words that were already present in the codebase when the spell checker was first introduced.


### Example

To add new words, edit `.vscode/cspell.json` and add them to the `"words"` array:

```json
{
    "words": [
        "myprojectname",
        "customterm",
        "technicalword"
    ]
}
```

### Guidelines

- Use lowercase for words
- Consider whether the word is truly legitimate or if it might be a typo

## Available Scripts

### PowerShell Version (Windows)
- **File**: `Invoke-Cspell.ps1`
- **Usage**: For Windows PowerShell environments

## Usage Examples

```powershell
# Check all files (default)
./eng/common/spelling/Invoke-Cspell.ps1

# Check specific files
./eng/common/spelling/Invoke-Cspell.ps1 -ScanGlobs 'sdk/*/*/PublicAPI/**/*.md'

# Check multiple globs (powershell invocation only)
./eng/common/spelling/Invoke-Cspell.ps1 -ScanGlobs @('sdk/storage/**', 'sdk/keyvault/**')

# Check single file
./eng/common/spelling/Invoke-Cspell.ps1 -ScanGlobs './README.md'
```

## Parameters

- **Job Type**: The cspell command to run (default: `lint`)
- **Scan Globs**: File patterns to check for spelling
- **Config Path**: Location of the cspell.json configuration file
- **Spell Check Root**: Root directory for relative paths
- **Package Cache**: Working directory for npm dependencies
- **Leave Cache**: Option to preserve the npm package cache

## Requirements

- Node.js and npm must be installed
- The `.vscode/cspell.json` configuration file must exist
- `jq` command-line JSON processor (for bash version)

## How It Works

1. Creates a temporary working directory for npm packages
2. Copies `package.json` and `package-lock.json` to the working directory
3. Installs npm dependencies using `npm ci`
4. Modifies the cspell configuration to include specified file globs
5. Runs cspell with the modified configuration
6. Restores the original configuration
7. Cleans up temporary files

The scripts ensure that a LICENSE file (or temporary file) is always included in the scan to meet cspell's requirements for the "files" array.