chocolatey / package-validator

Windows service to validate packages conform to package standards
Apache License 2.0
31 stars 29 forks source link

Guideline suggestion: avoid using aliases for builtin cmdlets #152

Open jberezanski opened 7 years ago

jberezanski commented 7 years ago

Aliases reduce script readability in many cases and may make scripts less robust (because they can be redefined by the user).

Here are a few statements on the topic:

https://blogs.msdn.microsoft.com/powershell/2006/04/25/is-it-safe-to-use-aliases-in-scripts/ https://blogs.technet.microsoft.com/heyscriptingguy/2011/05/01/best-practice-for-using-aliases-in-powershell-scripts/ https://poshoholic.com/2007/09/06/essential-powershell-avoid-shorthand-in-shared-powershell-scripts/

There is also a PSScriptAnalyzer rule for avoiding aliases: https://github.com/PowerShell/PSScriptAnalyzer/blob/development/RuleDocumentation/AvoidAlias.md

As there may be a lot of existing package scripts that use aliases, this definitely should not be a requirement (at least for the time being), but it would work as a Guideline, I think.