Skip to content

Commit 986e9cd

Browse files
🩹 [Refactor]: Suppress code analysis warnings for IsWindows variable in Build-PSModuleRootModule.ps1 to enhance compatibility with PS5.1
1 parent dd7608c commit 986e9cd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎scripts/helpers/Build/Build-PSModuleRootModule.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ $MyInvocation.MyCommand.ScriptBlock.Module.OnRemove = {
140140
$headerFilePath | Remove-Item -Force
141141
} else {
142142
Add-Content -Path $rootModuleFile -Force -Value @'
143+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
144+
'PSAvoidAssignmentToAutomaticVariable', 'IsWindows',
145+
Justification = 'IsWindows doesnt exist in PS5.1'
146+
)]
147+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
148+
'PSUseDeclaredVarsMoreThanAssignments', 'IsWindows',
149+
Justification = 'IsWindows doesnt exist in PS5.1'
150+
)]
143151
[CmdletBinding()]
144152
param()
145153
'@

0 commit comments

Comments
 (0)