Skip to content

Commit 17395fc

Browse files
azure-sdksima-zhu
andauthored
Clean up on cspell (Azure#23745)
Co-authored-by: sima-zhu <[email protected]>
1 parent 9a346c1 commit 17395fc

File tree

2 files changed

+2
-29
lines changed

2 files changed

+2
-29
lines changed

eng/common/pipelines/templates/steps/check-spelling.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
parameters:
1010
ContinueOnError: true
11-
TargetBranch: $(System.PullRequest.TargetBranch)
12-
SourceBranch: HEAD
1311
CspellConfigPath: ./.vscode/cspell.json
1412

1513
steps:
@@ -26,8 +24,6 @@ steps:
2624
targetType: filePath
2725
filePath: eng/common/scripts/check-spelling-in-changed-files.ps1
2826
arguments: >-
29-
-TargetBranch "origin/$("${{ parameters.TargetBranch }}" -replace "refs/heads/")"
30-
-SourceBranch ${{ parameters.SourceBranch }}
3127
-CspellConfigPath ${{ parameters.CspellConfigPath }}
3228
-ExitWithError:(!$${{ parameters.ContinueOnError }})
3329
pwsh: true

eng/common/scripts/check-spelling-in-changed-files.ps1

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,6 @@ and then uses the mutated config file to call cspell. In the case of success
2323
the temporary file is deleted. In the case of failure the temporary file, whose
2424
location was logged to the console, remains on disk.
2525
26-
.PARAMETER TargetBranch
27-
Git ref to compare changes. This is usually the "base" (GitHub) or "target"
28-
(DevOps) branch for which a pull request would be opened.
29-
30-
.PARAMETER SourceBranch
31-
Git ref to use instead of changes in current repo state. Use `HEAD` here to
32-
check spelling of files that have been committed and exclude any new files or
33-
modified files that are not committed. This is most useful in CI scenarios where
34-
builds may have modified the state of the repo. Leaving this parameter blank
35-
includes files for whom changes have not been committed.
36-
3726
.PARAMETER SpellCheckRoot
3827
Root folder from which to generate relative paths for spell checking. Mostly
3928
used in testing.
@@ -49,7 +38,7 @@ Exit with error code 1 if spelling errors are detected.
4938
Run test functions against the script logic
5039
5140
.EXAMPLE
52-
./eng/common/scripts/check-spelling-in-changed-files.ps1 -TargetBranch 'target_branch_name'
41+
./eng/common/scripts/check-spelling-in-changed-files.ps1
5342
5443
This will run spell check with changes in the current branch with respect to
5544
`target_branch_name`
@@ -58,12 +47,6 @@ This will run spell check with changes in the current branch with respect to
5847

5948
[CmdletBinding()]
6049
Param (
61-
[Parameter()]
62-
[string] $TargetBranch,
63-
64-
[Parameter()]
65-
[string] $SourceBranch,
66-
6750
[Parameter()]
6851
[string] $CspellConfigPath = (Resolve-Path "$PSScriptRoot/../../../.vscode/cspell.json"),
6952

@@ -101,7 +84,6 @@ function Test-Exit0WhenAllFilesExcluded() {
10184

10285
# Act
10386
&"$PSScriptRoot/check-spelling-in-changed-files.ps1" `
104-
-TargetBranch HEAD~1 `
10587
-CspellConfigPath "./.vscode/cspell.json" `
10688
-SpellCheckRoot "./" `
10789
-ExitWithError
@@ -120,7 +102,6 @@ function Test-Exit1WhenIncludedFileHasSpellingError() {
120102

121103
# Act
122104
&"$PSScriptRoot/check-spelling-in-changed-files.ps1" `
123-
-TargetBranch HEAD~1 `
124105
-CspellConfigPath "./.vscode/cspell.json" `
125106
-SpellCheckRoot "./" `
126107
-ExitWithError
@@ -139,7 +120,6 @@ function Test-Exit0WhenIncludedFileHasNoSpellingError() {
139120

140121
# Act
141122
&"$PSScriptRoot/check-spelling-in-changed-files.ps1" `
142-
-TargetBranch HEAD~1 `
143123
-CspellConfigPath "./.vscode/cspell.json" `
144124
-SpellCheckRoot "./" `
145125
-ExitWithError
@@ -162,7 +142,6 @@ function Test-Exit1WhenChangedFileAlreadyHasSpellingError() {
162142

163143
# Act
164144
&"$PSScriptRoot/check-spelling-in-changed-files.ps1" `
165-
-TargetBranch HEAD~1 `
166145
-CspellConfigPath "./.vscode/cspell.json" `
167146
-SpellCheckRoot "./" `
168147
-ExitWithError
@@ -185,7 +164,6 @@ function Test-Exit0WhenUnalteredFileHasSpellingError() {
185164

186165
# Act
187166
&"$PSScriptRoot/check-spelling-in-changed-files.ps1" `
188-
-TargetBranch HEAD~1 `
189167
-CspellConfigPath "./.vscode/cspell.json" `
190168
-SpellCheckRoot "./" `
191169
-ExitWithError
@@ -204,7 +182,6 @@ function Test-Exit0WhenSpellingErrorsAndNoExitWithError() {
204182

205183
# Act
206184
&"$PSScriptRoot/check-spelling-in-changed-files.ps1" `
207-
-TargetBranch HEAD~1 `
208185
-CspellConfigPath "./.vscode/cspell.json" `
209186
-SpellCheckRoot "./"
210187

@@ -287,7 +264,7 @@ if (!(Test-Path $CspellConfigPath)) {
287264
}
288265

289266
# Lists names of files that were in some way changed between the
290-
# current $SourceBranch and $TargetBranch. Excludes files that were deleted to
267+
# current branch and default target branch. Excludes files that were deleted to
291268
# prevent errors in Resolve-Path
292269
$changedFilesList = Get-ChangedFiles
293270

0 commit comments

Comments
 (0)