Closed
Description
When using a settings file for the Script Analyzer and specifying whitelisted aliases, the rule is only skipped if the alias matches using the exact case.
For example, if we use the following settings file (from the ReadMe):
# PSScriptAnalyzerSettings.psd1
@{
'Rules' = @{
'PSAvoidUsingCmdletAliases' = @{
'Whitelist' = @('cd')
}
}
}
If the user now uses "CD C:\Windows" the rule is still flagged. This may seem trivial but the typical user will expect that casing shouldn't matter when using aliases (e.g. people often use select/Select, foreach/ForEach interchangeably).
This is the relevant code in AvoidAlias.cs:
if (aliasName == null
|| whiteList.Contains(aliasName))
{
continue;
}