Skip to main content
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. Add this section to your repository’s .editorconfig to keep Dockerfiles and Containerfiles consistent:
[{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 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:
PropertyBehavior
indent_styleUses tabs when set to tab; otherwise uses spaces.
indent_sizeSets the number of spaces per indent level when it is a positive integer.
tab_widthUsed as the fallback indent width when indent_size is not a positive integer.
max_line_lengthYAML 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_lineShell heredocs only. Mirrors shfmt --binary-next-line.
switch_case_indentShell heredocs only. Mirrors shfmt --case-indent.
space_redirectsShell heredocs only. Mirrors shfmt --space-redirects.
keep_paddingShell heredocs only. Mirrors shfmt --keep-padding.
function_next_lineShell heredocs only. Mirrors shfmt --func-next-line.
simplifyShell heredocs only. Mirrors shfmt --simplify.
minifyShell heredocs only. Mirrors shfmt --minify and implies simplify.
Other EditorConfig properties are intentionally not interpreted by the heredoc formatter today:
PropertyReason
insert_final_newlineHeredoc bodies always need a newline before the terminator, so formatted payloads always end with exactly one newline regardless of this setting.
end_of_lineHeredoc payloads are embedded in the Dockerfile and should follow the parent Dockerfile’s line-ending convention rather than a separate virtual target setting.
charsettally already reads Dockerfiles as text and does not transcode heredoc payloads during formatting.
trim_trailing_whitespaceFormatted 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.