On 5/30/2024 6:23 AM, Alex Bennée wrote:
It's a pain when you come back to a code base you haven't touched in a while and realise whatever indent settings you were using having carried over. Add an editorconfig and be done with it. Signed-off-by: Alex Bennée <alex.ben...@linaro.org>
Adding an editorconfig seems like a great idea IMO. But I wonder - will it result in unintentional additional changes when saving a file that contains baseline non-conformance?
Related: would a .clang-format file also be useful? git-clang-format can be used to apply formatting changes only on the code that's been changed.
Also: should we consider excluding any exceptional files that we don't expect to conform?
--- v2 - drop mention of custom major modes (not needed here) - include section for assembly --- .editorconfig | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c72a55c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,29 @@ +# EditorConfig is a file format and collection of text editor plugins +# for maintaining consistent coding styles between different editors +# and IDEs. Most popular editors support this either natively or via +# plugin. +# +# Check https://editorconfig.org for details. +# + +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 + +[Makefile*] +indent_style = tab +indent_size = 8 +emacs_mode = makefile + +[*.{c,h}] +indent_style = space +indent_size = 4 +emacs_mode = c + +[*.{s,S}] +indent_style = tab +indent_size = 8 +emacs_mode = asm