Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 823 Bytes

ReviewUnusedParameter.md

File metadata and controls

53 lines (39 loc) · 823 Bytes
description ms.custom ms.date ms.topic title
ReviewUnusedParameter
PSSA v1.21.0
06/28/2023
reference
ReviewUnusedParameter

ReviewUnusedParameter

Severity Level: Warning

Description

This rule identifies parameters declared in a script, scriptblock, or function scope that have not been used in that scope.

How

Consider removing the unused parameter.

Example

Wrong

function Test-Parameter
{
    Param (
        $Parameter1,

        # this parameter is never called in the function
        $Parameter2
    )

    Get-Something $Parameter1
}

Correct

function Test-Parameter
{
    Param (
        $Parameter1,

        # now this parameter is being called in the same scope
        $Parameter2
    )

    Get-Something $Parameter1 $Parameter2
}