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/PSAvoidNullOrEmptyHelpMessageAttribute is a PSScriptAnalyzer diagnostic emitted by tally for PowerShell snippets embedded in Dockerfiles.
PropertyValue
SeverityWarning
CategoryPSScriptAnalyzer
Auto-fixNo

Description

The value of the HelpMessage attribute should not be an empty string or a null value as this causes PowerShell’s interpreter to throw an error when executing the function or cmdlet.

How

Specify a value for the HelpMessage attribute.

Examples

Problematic code

Function BadFuncEmptyHelpMessageEmpty
{
    Param(
        [Parameter(HelpMessage='')]
        [String]
        $Param
    )

    $Param
}

Function BadFuncEmptyHelpMessageNull
{
    Param(
        [Parameter(HelpMessage=$null)]
        [String]
        $Param
    )

    $Param
}

Function BadFuncEmptyHelpMessageNoAssignment
{
    Param(
        [Parameter(HelpMessage)]
        [String]
        $Param
    )

    $Param
}

Correct code

Function GoodFuncHelpMessage
{
    Param(
        [Parameter(HelpMessage='This is helpful')]
        [String]
        $Param
    )

    $Param
}

Source

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