PSUseDeclaredVarsMoreThanAssignments reported on "get-variable -include var1,var2"
Before submitting a bug report:
- Make sure you are able to repro it on the latest released version
- Perform a quick search for existing issues to check if this bug has already been reported
Steps to reproduce
$var1 = 'var1' $var2 = 'var2' $included = Get-Variable -Include var1, var2 write-host $included
Expected behavior
Actual behavior
throw error on both var1 and var2 variables
If an unexpected error was thrown then please report the full error details using e.g. $error[0] | Select-Object *
Environment data
> $PSVersionTable Name Value ---- ----- PSVersion 6.2.0 PSEdition Core GitCommitId 6.2.0 OS Microsoft Windows 10.0.17763 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.18.1 1.18.0