Skip to main content
powershell/PSAvoidReservedWordsAsFunctionNames is a PSScriptAnalyzer diagnostic emitted by tally for PowerShell snippets embedded in Dockerfiles.

Description

Avoid using reserved words as function names. Using reserved words as function names can cause errors or unexpected behavior in scripts.

How to Fix

Avoid using any of the reserved words as function names. Choose a different name that’s not a reserved word. See about_Reserved_Words for a list of reserved words in PowerShell.

Examples

Problematic code

Correct code

Source

This rule documentation is adapted from Microsoft’s PSScriptAnalyzer documentation for AvoidReservedWordsAsFunctionNames, licensed under CC BY 4.0.