Skip to content

Latest commit

 

History

History

Too-simple-function-names

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Too simple function names

Too simple function names in a script is a time bomb. A script may work fine until it is called in a session with an alias with accidentally the same name as a script function. This alias is invoked by a script, not an internal function, because on command name resolution PowerShell looks for an alias first. See help about_Command_Precedence.

Results are unpredictable. A script may even work without errors doing something unexpected until the problem is revealed somehow.

It looks like a good idea to use the Verb-Noun convention even for internal function names. This minimizes chances of conflicts. Aliases are not normally called Verb-Noun.

Note that script modules may have similar issues, see Conflict-with-aliases.

Scripts