Quality Gates
This page documents the quality gates and code standards currently enforced in HaloAPI.
Overview
HaloAPI quality checks are centered on these repo entrypoints:
pwsh -File .\DevOps\Quality\run-pssa.ps1
pwsh -File .\DevOps\Quality\test.ps1 -Suite Meta
The repo currently uses:
PSScriptAnalyzerfor static analysis.- HaloAPI-specific custom rules under
CustomRules/. - Inline parameter comments for functions where the custom rules require them.
- Comment-based help on public cmdlets.
PSScriptAnalyzer
Use the dedicated wrapper instead of ad hoc analyzer commands:
pwsh -File .\DevOps\Quality\run-pssa.ps1
The wrapper intentionally applies the full repo ruleset to Public/ and a reduced ruleset elsewhere.
Public-surface conventions currently enforced include:
- required comment-based help
- empty help section detection
- missing parameter description detection
- self-referential parameter alias detection
Tests
Use the dedicated test script rather than calling Invoke-Pester directly:
pwsh -File .\DevOps\Quality\test.ps1 -Suite Meta -Verbosity Detailed
Generate coverage through the same entrypoint:
pwsh -File .\DevOps\Quality\test.ps1 -Suite Meta -Verbosity Detailed -CodeCoverage
Code Coverage
Code coverage is generated in CI for the Meta and Unit suites.
CI enforces a minimum 70% coverage threshold for the Unit suite.
Coverage artifacts are uploaded for each run as:
code-coverage-meta-results(.artifacts/CodeCoverage.meta.xml)code-coverage-unit-results(.artifacts/CodeCoverage.unit.xml)
You can access them from the CI workflow runs:
Local Live and E2E Testing
Run test suites through the quality script entrypoints in DevOps/Quality.
For local Live and E2E runs, use the Key Vault wrapper script. It loads the required environment variables from Azure Key Vault before invoking DevOps/Quality/test.ps1.
-
Sign in to Azure first:
Connect-AzAccount -
Run the
Livesuite:pwsh -NoProfile -File .\DevOps\Quality\Invoke-HaloLiveTests.ps1 -Suite Live -Verbosity Normal -
Run both
LiveandE2Ein one invocation:pwsh -NoProfile -File .\DevOps\Quality\Invoke-HaloLiveTests.ps1 -Suite Live,E2E -Verbosity Normal
The wrapper expects these secrets in Key Vault (default vault name: MSPsUK):
HaloTestingURLHaloTestingClientIDHaloTestingClientSecretHaloTestingTenant
For non-live suites, use the standard test entrypoint directly:
pwsh -NoProfile -File .\DevOps\Quality\test.ps1 -Suite Meta,Unit -Verbosity Normal
CI Quality Gates
The GitHub Actions CI flow on develop currently validates:
- PSScriptAnalyzer on Windows.
- Cross-platform metadata smoke tests on Linux and macOS.
- Windows metadata tests with JUnit output and coverage artifact generation.
Expectations For Changes
When changing public cmdlets:
- keep comment-based help intact
- preserve exported function naming and aliasing conventions
- rerun
run-pssa.ps1 - rerun
test.ps1 -Suite Meta
When changing workflows:
- keep the repo script entrypoints as the source of truth
- avoid broadening secret usage unless required
- preserve the
developintegration branch andmainrelease branch behavior