Skip to contentSkip to conversation

editorconfig: add consistent formatting rules for LTP

PATCH In review Jan Polensky 2 participants 5 messages Mar 31 – Apr 15

lore
Share & tools
lore
#0 lore raw

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
new file mode 100644
index 000000000000..b09145a3332f
@@ -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
#1 lore raw

This is a nice improvement, patch merged, thanks!

Signature · 6 lines
Regards,
Li Wang


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by Li Wang on v3 1/1
#3 lore raw
In reply to Jan Polensky
Quoted 4 lines · Jan Polensky

Introduce .editorconfig to keep indentation and whitespace consistent across editors, preventing accidental reformatting and noisy diffs.

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