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

> Use consistent indentation

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

| Property | Value            |
| -------- | ---------------- |
| Severity | Warning          |
| Category | PSScriptAnalyzer |
| Auto-fix | No               |

## Description

Indentation should be consistent throughout the source file.

**Note**: This rule is not enabled by default. The user needs to enable it through settings.

## Configuration

```powershell theme={null}
    Rules = @{
        PSUseConsistentIndentation = @{
            Enable = $true
            IndentationSize = 4
            PipelineIndentation = 'IncreaseIndentationForFirstPipeline'
            Kind = 'space'
        }
    }
```

### Parameters

#### Enable: bool (Default value is `$false`)

Enable or disable the rule during ScriptAnalyzer invocation.

#### IndentationSize: int (Default value is `4`)

Indentation size in the number of space characters.

#### PipelineIndentation: string (Default value is `IncreaseIndentationForFirstPipeline`)

Whether to increase indentation after a pipeline for multi-line statements. The settings are:

* IncreaseIndentationForFirstPipeline (default): Indent once after the first pipeline and keep this
  indentation. Example:

  ```powershell theme={null}
  foo |
      bar |
      baz
  ```

* IncreaseIndentationAfterEveryPipeline: Indent more after the first pipeline and keep this
  indentation. Example:

  ```powershell theme={null}
  foo |
      bar |
          baz
  ```

* NoIndentation: Do not increase indentation. Example:

  ```powershell theme={null}
  foo |
  bar |
  baz
  ```

* None: Do not change any existing pipeline indentation.

#### Kind: string (Default value is `space`)

Represents the kind of indentation to be used. Possible values are: `space`, `tab`. If any invalid
value is given, the property defaults to `space`.

`space` means `IndentationSize` number of `space` characters are used to provide one level of
indentation. `tab` means a tab character, `\t`.

## Source

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