Skip to main content

Documentation Index

Fetch the complete documentation index at: https://tally.wharflab.com/llms.txt

Use this file to discover all available pages before exploring further.

powershell/PSAvoidReservedWordsAsFunctionNames is a PSScriptAnalyzer diagnostic emitted by tally for PowerShell snippets embedded in Dockerfiles.
PropertyValue
SeverityWarning
CategoryPSScriptAnalyzer
Auto-fixNo

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

# Function is a reserved word
function function {
    Write-Host "Hello, World!"
}

Correct code

# myFunction is not a reserved word
function myFunction {
    Write-Host "Hello, World!"
}

Source

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