Context
No .editorconfig in the repo. A contributor's editor picks
its own defaults for indent, EOL, and final newline — and the
next git diff looks like a noise storm because every line
moves. Two contributors on Windows recently committed CRLF
into requirements.txt and Readme.md; a single config file
would have prevented it.
What to change
Create .editorconfig at the repo root:
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
[*.{md,yaml,yml,json,toml}]
indent_size = 2
[Makefile]
indent_style = tab
How to verify
git config --get core.autocrlf is whatever the user set
(we don't override git config), but git diff after editing
a file shows zero \\ No newline at end of file warnings.
- Most editors (VS Code, PyCharm, Sublime) auto-detect the
file and apply the rules without further config.
- The file is ≤ 20 lines and has a short comment explaining
the [*] defaults.
Skill: cross-platform hygiene.
Estimated effort: S.
Context
No
.editorconfigin the repo. A contributor's editor picksits own defaults for indent, EOL, and final newline — and the
next
git difflooks like a noise storm because every linemoves. Two contributors on Windows recently committed CRLF
into
requirements.txtandReadme.md; a single config filewould have prevented it.
What to change
Create
.editorconfigat the repo root:How to verify
git config --get core.autocrlfis whatever the user set(we don't override git config), but
git diffafter editinga file shows zero
\\ No newline at end of filewarnings.file and apply the rules without further config.
the
[*]defaults.Skill: cross-platform hygiene.
Estimated effort: S.