Skip to main content
powershell/PSReservedCmdletChar is a PSScriptAnalyzer diagnostic emitted by tally for PowerShell snippets embedded in Dockerfiles.
tally disables this rule by default for Dockerfile RUN snippets because a RUN executes statements inline rather than defining cmdlets, parameters, or modules with external callers. Re-enable it with include = ["powershell/PSReservedCmdletChar"] or by setting rules.powershell.PSReservedCmdletChar.severity = "warning" in .tally.toml.

Description

You cannot use following reserved characters in a function or cmdlet name as these can cause parsing or runtime errors. Reserved Characters include: #,(){}[]&/\\$^;:\"'<>|?@`*%+=~

How

Remove reserved characters from names.

Examples

Problematic code

Correct code

Source

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