You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Invoke-ScriptAnalyzer-ScriptDefinition 'foreach ($Host in $foo) {}'
Expected behavior
The Variable 'Host' cannot be assigned since it is a readonly automatic variable that is built into PowerShell, please use a different name.
Actual behavior
Environment data
>$PSVersionTable
Name Value
---------
PSVersion 7.4.4
PSEdition Core
GitCommitId 7.4.4
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0> (Get-Module-ListAvailable PSScriptAnalyzer).Version |ForEach-Object { $_.ToString() }
1.22.0
The text was updated successfully, but these errors were encountered:
PoshAJ
changed the title
Implicit Variable Assignment by foreach isn't Validated by PSAvoidAssignmentToAutomaticVariable
foreach Variable Assignment isn't Validated by PSAvoidAssignmentToAutomaticVariable
Aug 10, 2024
Steps to reproduce
Expected behavior
Actual behavior
Environment data
The text was updated successfully, but these errors were encountered: