Open KirkMunro opened 8 years ago
I suppose I was making an assumption that I should verify: PSScriptAnalyzer already warns when you use parameter aliases or parameter shorthand, does it not? If not, it definitely should, at least for the latter.
At this point, PSScriptAnalyzer doesn't have a rule that warns if you use parameter aliases or parameter shorthand. So, we now are two taking about two new rules -
Here's a little known feature that could come back to bite someone later with a broken script:
gsv blah -ea ig
I'm not sure in which version of PowerShell this was added, but you can now use partial enumeration values and as long as that partial value leads to an unambiguous match, it will be accepted.
This may result in errors in scripts that appear to be working correctly if a new emumeration value is added with the same leading characters as those that are in use within a script. It's the same issue/risk with using partial parameter names in scripts. Shorthand should be for ad-hoc use only, and PSScriptAnalyzer should have a rule that warns whenever an enumeration value is used in a script in shorthand (such as in the command above).