2
0

spellcheck.ps1 703 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env pwsh
  2. <#
  3. .SYNOPSIS
  4. Checks spelling of code and docs.
  5. #>
  6. # Get path.
  7. $scriptDir = Split-Path $PSCommandPath -Parent
  8. $projectDir = (Get-Item $scriptDir).Parent
  9. # Set working directory to root of project.
  10. Push-Location $projectDir
  11. $ExitCode = 0
  12. # Run spell checker.
  13. codespell coderedcms docs
  14. $ExitCode = $LastExitCode
  15. # Print output.
  16. if ($ExitCode -eq 0) {
  17. Write-Host "Spelling looks good!"
  18. }
  19. else {
  20. # Write the error in a way that shows up as the failure reason in Azure Pipelines.
  21. Write-Host -ForegroundColor Red `
  22. "##vso[task.LogIssue type=error;]Spelling errors! 👩‍🏫"
  23. }
  24. # Unset working directory and exit with pytest's code.
  25. Pop-Location
  26. exit $ExitCode