Skip to content

Commit 9db23c5

Browse files
committed
fix: suppress diagnostic warnings for OS variable assignments in Get-EnvironmentInfo function
1 parent cfe8e8e commit 9db23c5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Profile and Prompt/PSProfileBase.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
function Get-EnvironmentInfo {
2323
# Get environment information for the current session. Returns a hash table.
2424
[CmdletBinding()]
25-
25+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', 'PSProfileBase.ps1', Justification = 'OS variables were only introduced in PowerShell 6, so no conflict is introduced in Windows PowerShell.')]
2626
param ()
2727

2828
$IsAdmin = if (($PSVersionTable.PSVersion.Major -le 5) -or $IsWindows) {
@@ -34,8 +34,8 @@ function Get-EnvironmentInfo {
3434
}
3535

3636
if ($PSVersionTable.PSEdition -eq 'Desktop' -or $PSVersionTable.PSVersion -lt '6.0.0') {
37-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', 'PSProfileBase.ps1', Justification = 'This variable was only introduced in PowerShell 6, so no conflict is introduced in Windows PowerShell.')]
3837
$IsWindows = $true
38+
$IsLinux = $IsMacOS = $false
3939
if ($Host.Name -eq 'Windows PowerShell ISE Host') {
4040
$IsPowerShellISE = $true
4141
} else {

0 commit comments

Comments
 (0)