editorconfig: add consistent formatting rules for LTP
PATCH v3 1/1 editorconfig: add consistent formatting rules for LTP
Introduce .editorconfig to keep indentation and whitespace consistent across editors, preventing accidental reformatting and noisy diffs.
---
Changes since v2:
- Use kernel-style tabs for C/ASM/shell. (Thanks Andrea, Petr)
- Split Python/Perl indentation: *.py uses 4 spaces; *.pl keeps tabs. (Thanks Andrea)
Changes since v1 (thanks Petr):
- License identifier: GPL-2.0 -> GPL-2.0-or-later
- Drop awk
- Treat Python/Perl special files
- indent_size=4 for *.{c,h,S,sh} and ver_linux
- Fix indent_size for .rst/.md to 4
.editorconfig | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .editorconfig
.editorconfig new file +43 -0
@@ -0,0 +1,43 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +root = true + +# Default for all files +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +tab_width = 8 + +# C/Assembly source files, headers, and shell files use tabs +[{*.{c,h,S,sh},ver_linux}] +indent_style = tab +indent_size = tab + +[{Makefile,Makefile.*,*.{mk.in,mk}}] +indent_style = tab +indent_size = tab + +[*.py] +indent_style = space +indent_size = 4 + +[*.pl] +indent_style = tab +indent_size = tab + +# Exceptions use spaces: Python (Sphinx, scripts), Perl (checkbashisms.pl vendored) +[{doc/conf.py,scripts/*.py,scripts/checkbashisms.pl}] +indent_style = space +indent_size = 4 + +# Documentation files +[*.{rst,md}] +indent_style = space +indent_size = 4 + +# JSON files +[*.json] +indent_style = space +indent_size = 4
--
2.53.0
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
This is a nice improvement, patch merged, thanks!
Signature · 6 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 1 line
This is a nice improvement, patch merged, thanks!
Oh, sorry, I actually merged another patch, but wrongly replied to this email.
https://lists.linux.it/pipermail/ltp/2026-April/047395.html
--
Regards,
Li Wang
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 4 lines · Jan Polensky
Introduce .editorconfig to keep indentation and whitespace consistent across editors, preventing accidental reformatting and noisy diffs.
Signed-off-by Jan Polensky <[email protected]>
Woo! I replied to the wrong post, but I didn't say anything wrong. This patch is also very good.
I would leave Petr or Andrea to merge it.
Anyway:
Signature · 6 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Merged thanks!
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp