Skip to content

Extend PSAvoidUsingCmdletAliases rule to also warn about implicitly aliased cmdlets via automatic Get- discovery #926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bergmeister opened this issue Mar 10, 2018 · 0 comments · Fixed by #927

Comments

@bergmeister
Copy link
Collaborator

Steps to reproduce

PowerShell has this undocumented feature that if it cannot find/resolve a command, it will try to append Get- to the command as a last resort of finding it. As far as I am aware, this works on every version of PowerShell but using it in a script should maybe be discouraged because

  • It could make maintenance hard, should this undocumented feature get broken, therefore a script should not rely on it
  • It could make the script difficult to read for many people
Invoke-ScriptAnalyzer -ScriptDefinition 'Verb' # Executing 'Verb' will execute 'Get-Verb'

Expected behavior

A warning should be given, the most appropriate one is probably PSAvoidUsingCmdletAliases since having a rule of its own is not worth the expense (computational, maintenance and for people managing their rule set)

Actual behavior

No warning

Environment data

Latest development version of 16.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant