Resolve PowerShell lint errors and enable CI enforcement#1988
Merged
Conversation
- Fix trailing whitespace in Invoke-Rest.ps1, Save-FinOpsHubTemplate.ps1, Start-FinOpsCostExport.ps1 - Add UTF-8 BOM encoding to Get-FinOpsCostExport.ps1, Remove-FinOpsCostExport.ps1, Start-FinOpsCostExport.ps1 - Fix OutputType mismatch in Split-AzureResourceId.ps1 - Add ShouldProcess support to Initialize-FinOpsHubDeployment.ps1, New-FinOpsCostExport.ps1, Start-FinOpsCostExport.ps1 - Replace Write-Host with Write-Information in Remove-FinOpsHub.ps1 - Refactor global variable to function in Initialize-Tests.ps1 Configuration improvements: - Add charset=utf-8-bom for PowerShell files in .editorconfig - Add files.encoding and trimTrailingWhitespace for PowerShell in VS Code settings - Enable Pester Run.Exit to fail CI on test failures Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR targets PowerShell code quality and CI reliability in the FinOps toolkit by resolving PowerShell lint issues (formatting/encoding and PSScriptAnalyzer rules) and ensuring test failures correctly fail the build.
Changes:
- Updated several PowerShell cmdlets to align with lint rules (ShouldProcess support, OutputType consistency, and replacing
Write-Hostusage). - Normalized PowerShell file encoding/whitespace handling via
.editorconfigand VS Code workspace settings. - Fixed CI/Pester invocation so failed tests produce a non-zero exit code.
Reviewed changes
Copilot reviewed 14 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/powershell/Tests/Unit/New-FinOpsCostExport.Tests.ps1 | Updates assertions for trimmed default storage path behavior. |
| src/powershell/Tests/Unit/Deploy-FinOpsHub.Tests.ps1 | Improves mocks to match actual function calls/signatures. |
| src/powershell/Tests/Integration/Hubs.Tests.ps1 | Removes dependency on a global variable; uses helper function instead. |
| src/powershell/Tests/Initialize-Tests.ps1 | Replaces a global test variable with a helper function returning required RPs. |
| src/powershell/Public/Start-FinOpsCostExport.ps1 | Adds SupportsShouldProcess handling and formatting fixes. |
| src/powershell/Public/Remove-FinOpsHub.ps1 | Replaces Write-Host with Write-Information for deletion output. |
| src/powershell/Public/Remove-FinOpsCostExport.ps1 | Updates file encoding (BOM). |
| src/powershell/Public/New-FinOpsCostExport.ps1 | Adds SupportsShouldProcess and gates creation/run behavior under ShouldProcess. |
| src/powershell/Public/Initialize-FinOpsHubDeployment.ps1 | Wraps provider registration call behind ShouldProcess. |
| src/powershell/Public/Get-FinOpsCostExport.ps1 | Updates file encoding (BOM). |
| src/powershell/Private/Split-AzureResourceId.ps1 | Adjusts return type to match declared OutputType. |
| src/powershell/Private/Save-FinOpsHubTemplate.ps1 | Trims whitespace-only line. |
| src/powershell/Private/Invoke-Rest.ps1 | Removes trailing whitespace. |
| .vscode/settings.json | Enforces PowerShell encoding and trimming behavior in VS Code. |
| .editorconfig | Sets PowerShell file charset to UTF-8 BOM and standardizes indentation. |
| .build/BuildHelper/Start-PesterTest.ps1 | Ensures Pester exits non-zero on test failures (Run.Exit = $true). |
Collaborator
Author
|
🤖 [AI][Claude] PR Update Summary Addressed: 5 thread(s)
Changes:
Discussion: |
- Skip Write-Error for throttled responses in Start-FinOpsCostExport to prevent termination when ErrorActionPreference is Stop - Add missing Initialize-FinOpsHubDeployment mocks in Deploy-FinOpsHub test contexts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
|
The 2 failing checks are resolved by PR #2021 |
RolandKrummenacher
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠️ Description
This PR fixes all 12 PowerShell lint errors and adds configuration to prevent future issues. It also fixes a critical CI issue where lint/unit test failures were not actually failing the GitHub Action.
Lint fixes:
@{}to[AzureResourceIdInfo]@{}Get-FinOpsHubRequiredResourceProviderfunctionConfiguration improvements:
.editorconfig: Addedcharset = utf-8-bomfor.ps1,.psm1,.psd1files.vscode/settings.json: Addedfiles.encoding: utf8bomandfiles.trimTrailingWhitespace: truefor PowerShellCI fix:
.build/BuildHelper/Start-PesterTest.ps1: Added$pesterArgs.Run.Exit = $trueso Pester returns non-zero exit code on test failures, which will now fail the GitHub Action📋 Checklist
🔬 How did you test this change?
🙋♀️ Do any of the following that apply?
📑 Did you update
docs/changelog.md?📖 Did you update documentation?
🤖 Generated with Claude Code