diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index 859769b3bb97..255b77f647ac 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -158,6 +158,8 @@ jobs: - template: /eng/common/pipelines/templates/steps/validate-filename.yml - template: /eng/common/pipelines/templates/steps/check-spelling.yml + parameters: + ScriptToValidateUpgrade: eng/scripts/spell-check-public-api.ps1 - template: /eng/common/pipelines/templates/steps/verify-links.yml parameters: diff --git a/eng/scripts/Export-API.ps1 b/eng/scripts/Export-API.ps1 index 6c680dfe0086..c3b04fc21857 100644 --- a/eng/scripts/Export-API.ps1 +++ b/eng/scripts/Export-API.ps1 @@ -51,11 +51,18 @@ foreach ($file in $apiListingFiles) { } if ($SpellCheckPublicApiSurface) { - Write-Host "Spell check public API surface (found $($apiListingFiles.Count) files)" - &"$PSScriptRoot/../common/spelling/Invoke-Cspell.ps1" ` - -FileList $apiListingFiles.FullName + Write-Host "Spell check public API surface" + + if ($PSCmdlet.ParameterSetName -eq 'PackagePath') { + &"$PSScriptRoot/spell-check-public-api.ps1" ` + -RelativePackagePath $relativePackagePath + } else { + &"$PSScriptRoot/spell-check-public-api.ps1" ` + -ServiceDirectory $relativePackagePath + } if ($LASTEXITCODE) { Write-Host "##vso[task.LogIssue type=error;]Spelling errors detected. To correct false positives or learn about spell checking see: https://aka.ms/azsdk/engsys/spellcheck" + exit $LASTEXITCODE } } diff --git a/eng/scripts/spell-check-public-api.ps1 b/eng/scripts/spell-check-public-api.ps1 new file mode 100644 index 000000000000..e2ac63ac5ced --- /dev/null +++ b/eng/scripts/spell-check-public-api.ps1 @@ -0,0 +1,25 @@ +param( + $ServiceDirectory = '', + $RelativePackagePath = '' +) + +if ($ServiceDirectory -and $RelativePackagePath) { + throw "Cannot specify both ServiceDirectory and RelativePackagePath parameters." +} + +Set-StrictMode -Version 3.0 +."$PSScriptRoot/../common/scripts/common.ps1" + +$files = @() +if ($ServiceDirectory) { + $files = Get-ChildItem -Path "$PSScriptRoot/../../sdk/$ServiceDirectory/*/api/*.cs" -File +} elseif ($RelativePackagePath) { + $files = Get-ChildItem -Path "$PSScriptRoot/../../sdk/$RelativePackagePath/api/*.cs" -File +} else { + $files = Get-ChildItem -Path "$PSScriptRoot/../../sdk/*/*/api/*.cs" -File +} + +Write-Host "Found $($files.Count) public API surface files to spell check." +."$PSScriptRoot/../common/spelling/Invoke-Cspell.ps1" ` + -CSpellConfigPath "./.vscode/cspell.json" ` + -FileList $files.FullName diff --git a/sdk/recoveryservices/cspell.yaml b/sdk/recoveryservices/cspell.yaml new file mode 100644 index 000000000000..17ffd65ed593 --- /dev/null +++ b/sdk/recoveryservices/cspell.yaml @@ -0,0 +1,6 @@ +import: + - ../../.vscode/cspell.json +overrides: + - filename: '**/sdk/recoveryservices/**' + words: + - bcdr