2
0

spellcheck.ps1 771 B

12345678910111213141516171819202122232425262728293031323334
  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 --skip="migrations,vendor,_build,*.css.map,*.jpg,*.png,*.pyc" `
  14. wagtailcrx docs
  15. $ExitCode = $LastExitCode
  16. # Print output.
  17. if ($ExitCode -eq 0) {
  18. Write-Host "Spelling looks good!"
  19. }
  20. else {
  21. # Write the error in a way that shows up as the failure reason in Azure Pipelines.
  22. Write-Host -ForegroundColor Red `
  23. "##vso[task.LogIssue type=error;]Spelling errors! 👩‍🏫"
  24. }
  25. # Unset working directory and exit with pytest's code.
  26. Pop-Location
  27. exit $ExitCode