Search Wiki:

UseSingularNouns


TypeName UseSingularNouns
CheckId PS1007
Error-Level Warning
Category Microsoft.PowerShell
Certainty 75%
BreakingChangeDepends on fix
Cause A cmdlet name has a plural noun.
Rule descriptionThe noun in a cmdlet name must be singular. For example, use the name Get-Process instead of Get-Processes. Follow this rule for all cmdlet names, even when a cmdlet gets or sets multiple items.
How to fix violations Change the noun to singular form. To mitigate the resulting breaking change, add a command alias that associates the original command name with the new one. Command aliases can have names that include plural nouns.
When to exclude warnings Do not suppress warnings from this rule.
Related rules UseSingularParameterNames, UsePascalCasingInVerbsAndNouns
See also FxCop Rules for Windows PowerShell

Examples


This cmdlet violates the rule, because it uses a plural noun: “Children”. A singular form (“Child”) should be used instead to help with cmdlet discoverability.
    [Cmdlet("Get", "Children")]
    public class GetChildrenCommand : PSCmdlet
    {
        // ...
    }

Back to FxCop Rules for Windows PowerShell.
Last edited Mar 26 2010 at 5:27 PM  by JuneB, version 1
Updating...
Page view tracker