> ## 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.

# EditorConfig integration

> Use EditorConfig settings to keep tally formatting fixes aligned with your repository style.

tally reads `.editorconfig` for formatting rules that need repository style preferences. Use `.editorconfig` for shared whitespace and indentation
settings, and use `.tally.toml` for enabling, disabling, or changing the severity of lint rules.

This page will collect tally features that integrate with EditorConfig as they are added.

## Recommended Dockerfile settings

Add this section to your repository's `.editorconfig` to keep Dockerfiles and Containerfiles consistent:

```ini theme={null}
[{Containerfile,Containerfile.,Dockerfile,Dockerfile.}*]
indent_style = tab
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
```

The pattern matches `Dockerfile`, `Dockerfile.*`, `Containerfile`, and `Containerfile.*`.

## Rules that use EditorConfig

* [`tally/prefer-formatted-heredocs`](/rules/tally/prefer-formatted-heredocs) formats `COPY` and `ADD` heredoc bodies for JSON, YAML, TOML, XML, and
  INI files, plus shell heredocs from executable `RUN` heredocs and `COPY` heredocs with a shell shebang or `.sh` destination. PowerShell heredocs
  are formatted through PSScriptAnalyzer and do not use EditorConfig today.

For structured heredoc payloads, tally resolves EditorConfig settings using a virtual filename next to the Dockerfile and the heredoc destination
basename. For example, a heredoc in `services/api/Dockerfile` targeting `/etc/app/config.yaml` is resolved as `services/api/config.yaml`, so
`*.yaml` and `config.yaml` sections apply.

`COPY` shell heredocs use that same destination-basename lookup. For example, a heredoc targeting `/usr/local/bin/entrypoint.sh` is resolved as
`entrypoint.sh`, so `*.sh` and `entrypoint.sh` sections apply.

For `RUN` shell heredocs, tally uses a virtual filename next to the Dockerfile named `Dockerfile.heredoc.<dialect>`, such as
`Dockerfile.heredoc.sh`, `Dockerfile.heredoc.bash`, or `Dockerfile.heredoc.zsh`.

## Supported Properties

The heredoc formatter currently reads these EditorConfig properties:

| Property             | Behavior                                                                                                                                                                                                                                                                                                                             |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `indent_style`       | Uses tabs when set to `tab`; otherwise uses spaces.                                                                                                                                                                                                                                                                                  |
| `indent_size`        | Sets the number of spaces per indent level when it is a positive integer.                                                                                                                                                                                                                                                            |
| `tab_width`          | Used as the fallback indent width when `indent_size` is not a positive integer.                                                                                                                                                                                                                                                      |
| `max_line_length`    | YAML and shell heredocs. For YAML, a positive integer is used as the preferred scalar wrapping width. For shell heredocs, a positive integer is used as the preferred command wrapping width; unset and invalid values use `100`, and `off` disables the shell line-width pass. This is a formatting preference, not a hard maximum. |
| `binary_next_line`   | Shell heredocs only. Mirrors `shfmt --binary-next-line`.                                                                                                                                                                                                                                                                             |
| `switch_case_indent` | Shell heredocs only. Mirrors `shfmt --case-indent`.                                                                                                                                                                                                                                                                                  |
| `space_redirects`    | Shell heredocs only. Mirrors `shfmt --space-redirects`.                                                                                                                                                                                                                                                                              |
| `keep_padding`       | Shell heredocs only. Mirrors `shfmt --keep-padding`.                                                                                                                                                                                                                                                                                 |
| `function_next_line` | Shell heredocs only. Mirrors `shfmt --func-next-line`.                                                                                                                                                                                                                                                                               |
| `simplify`           | Shell heredocs only. Mirrors `shfmt --simplify`.                                                                                                                                                                                                                                                                                     |
| `minify`             | Shell heredocs only. Mirrors `shfmt --minify` and implies `simplify`.                                                                                                                                                                                                                                                                |

Other EditorConfig properties are intentionally not interpreted by the heredoc formatter today:

| Property                   | Reason                                                                                                                                                                                                                                   |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `insert_final_newline`     | Heredoc bodies always need a newline before the terminator, so formatted payloads always end with exactly one newline regardless of this setting.                                                                                        |
| `end_of_line`              | Heredoc payloads are embedded in the Dockerfile and should follow the parent Dockerfile's line-ending convention rather than a separate virtual target setting.                                                                          |
| `charset`                  | tally already reads Dockerfiles as text and does not transcode heredoc payloads during formatting.                                                                                                                                       |
| `trim_trailing_whitespace` | Formatted output for the currently supported structured formats does not emit incidental trailing whitespace. tally does not read this property or run a separate trimming pass, because whitespace may be payload data in some formats. |
