Clean up on cspell (#3487)

Co-authored-by: sima-zhu <sizhu@microsoft.com>
This commit is contained in:
Azure SDK Bot 2022-03-30 09:51:18 -07:00 committed by GitHub
parent 731a4e632b
commit cb291def7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 29 deletions

View File

@ -8,8 +8,6 @@
parameters:
ContinueOnError: true
TargetBranch: $(System.PullRequest.TargetBranch)
SourceBranch: HEAD
CspellConfigPath: ./.vscode/cspell.json
steps:
@ -26,8 +24,6 @@ steps:
targetType: filePath
filePath: eng/common/scripts/check-spelling-in-changed-files.ps1
arguments: >-
-TargetBranch "origin/$("${{ parameters.TargetBranch }}" -replace "refs/heads/")"
-SourceBranch ${{ parameters.SourceBranch }}
-CspellConfigPath ${{ parameters.CspellConfigPath }}
-ExitWithError:(!$${{ parameters.ContinueOnError }})
pwsh: true

View File

@ -23,17 +23,6 @@ and then uses the mutated config file to call cspell. In the case of success
the temporary file is deleted. In the case of failure the temporary file, whose
location was logged to the console, remains on disk.
.PARAMETER TargetBranch
Git ref to compare changes. This is usually the "base" (GitHub) or "target"
(DevOps) branch for which a pull request would be opened.
.PARAMETER SourceBranch
Git ref to use instead of changes in current repo state. Use `HEAD` here to
check spelling of files that have been committed and exclude any new files or
modified files that are not committed. This is most useful in CI scenarios where
builds may have modified the state of the repo. Leaving this parameter blank
includes files for whom changes have not been committed.
.PARAMETER SpellCheckRoot
Root folder from which to generate relative paths for spell checking. Mostly
used in testing.
@ -49,7 +38,7 @@ Exit with error code 1 if spelling errors are detected.
Run test functions against the script logic
.EXAMPLE
./eng/common/scripts/check-spelling-in-changed-files.ps1 -TargetBranch 'target_branch_name'
./eng/common/scripts/check-spelling-in-changed-files.ps1
This will run spell check with changes in the current branch with respect to
`target_branch_name`
@ -58,12 +47,6 @@ This will run spell check with changes in the current branch with respect to
[CmdletBinding()]
Param (
[Parameter()]
[string] $TargetBranch,
[Parameter()]
[string] $SourceBranch,
[Parameter()]
[string] $CspellConfigPath = (Resolve-Path "$PSScriptRoot/../../../.vscode/cspell.json"),
@ -101,7 +84,6 @@ function Test-Exit0WhenAllFilesExcluded() {
# Act
&"$PSScriptRoot/check-spelling-in-changed-files.ps1" `
-TargetBranch HEAD~1 `
-CspellConfigPath "./.vscode/cspell.json" `
-SpellCheckRoot "./" `
-ExitWithError
@ -120,7 +102,6 @@ function Test-Exit1WhenIncludedFileHasSpellingError() {
# Act
&"$PSScriptRoot/check-spelling-in-changed-files.ps1" `
-TargetBranch HEAD~1 `
-CspellConfigPath "./.vscode/cspell.json" `
-SpellCheckRoot "./" `
-ExitWithError
@ -139,7 +120,6 @@ function Test-Exit0WhenIncludedFileHasNoSpellingError() {
# Act
&"$PSScriptRoot/check-spelling-in-changed-files.ps1" `
-TargetBranch HEAD~1 `
-CspellConfigPath "./.vscode/cspell.json" `
-SpellCheckRoot "./" `
-ExitWithError
@ -162,7 +142,6 @@ function Test-Exit1WhenChangedFileAlreadyHasSpellingError() {
# Act
&"$PSScriptRoot/check-spelling-in-changed-files.ps1" `
-TargetBranch HEAD~1 `
-CspellConfigPath "./.vscode/cspell.json" `
-SpellCheckRoot "./" `
-ExitWithError
@ -185,7 +164,6 @@ function Test-Exit0WhenUnalteredFileHasSpellingError() {
# Act
&"$PSScriptRoot/check-spelling-in-changed-files.ps1" `
-TargetBranch HEAD~1 `
-CspellConfigPath "./.vscode/cspell.json" `
-SpellCheckRoot "./" `
-ExitWithError
@ -204,7 +182,6 @@ function Test-Exit0WhenSpellingErrorsAndNoExitWithError() {
# Act
&"$PSScriptRoot/check-spelling-in-changed-files.ps1" `
-TargetBranch HEAD~1 `
-CspellConfigPath "./.vscode/cspell.json" `
-SpellCheckRoot "./"
@ -287,7 +264,7 @@ if (!(Test-Path $CspellConfigPath)) {
}
# Lists names of files that were in some way changed between the
# current $SourceBranch and $TargetBranch. Excludes files that were deleted to
# current branch and default target branch. Excludes files that were deleted to
# prevent errors in Resolve-Path
$changedFilesList = Get-ChangedFiles