> ## 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/PSUseSingularNouns

> Cmdlet Singular Noun

`powershell/PSUseSingularNouns` is a PSScriptAnalyzer diagnostic emitted by tally for PowerShell snippets embedded in Dockerfiles.

| Property | Value             |
| -------- | ----------------- |
| Severity | Warning           |
| Category | PSScriptAnalyzer  |
| Default  | Disabled in tally |
| Auto-fix | No                |

<Note>
  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/PSUseSingularNouns"]` or by setting
  `rules.powershell.PSUseSingularNouns.severity = "warning"` in `.tally.toml`.
</Note>

## Description

PowerShell team best practices state cmdlets should use singular nouns and not plurals. Suppression
allows you to suppress the rule for specific function names. For example:

```text theme={null}
function Get-Elements {
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', 'Get-Elements')]
    Param()
}
```

## Configuration

```powershell theme={null}
Rules = @{
    PSUseSingularNouns = @{
        Enable           = $true
        NounAllowList    = 'Data', 'Windows', 'Foos'
    }
}
```

### Parameters

* `Enable`: `bool` (Default value is `$true`)

  Enable or disable the rule during ScriptAnalyzer invocation.

* `NounAllowList`: `string[]` (Default value is `{'Data', 'Windows'}`)

  Commands to be excluded from this rule. `Data` and `Windows` are common false positives and are
  excluded by default.

## How

Change plurals to singular.

## Examples

### Problematic code

```powershell theme={null}
function Get-Files
{
    ...
}
```

### Correct code

```powershell theme={null}
function Get-File
{
    ...
}
```

## Source

This rule documentation is adapted from Microsoft's PSScriptAnalyzer documentation for
[UseSingularNouns](https://github.com/MicrosoftDocs/PowerShell-Docs-Modules/blob/main/reference/docs-conceptual/PSScriptAnalyzer/Rules/UseSingularNouns.md),
licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
