[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230404075540.14422-1-ihuguet@redhat.com>
Date: Tue, 4 Apr 2023 09:55:40 +0200
From: Íñigo Huguet <ihuguet@...hat.com>
To: ojeda@...nel.org, masahiroy@...nel.org, jgg@...dia.com,
mic@...ikod.net
Cc: linux-kernel@...r.kernel.org,
Íñigo Huguet <ihuguet@...hat.com>
Subject: [PATCH v2] Add .editorconfig file for basic formatting
EditorConfig is a specification to define the most basic code formatting
stuff, and it's supported by many editors and IDEs, either directly or
via plugins, including VSCode/VSCodium, Vim, emacs and more.
It allows to define formatting style related to indentation, charset,
end of lines and trailing whitespaces. It also allows to apply different
formats for different files based on wildcards, so for example it is
possible to apply different configs to *.{c,h}, *.py and *.rs.
In linux project, defining a .editorconfig might help to those people
that work on different projects with different indentation styles, so
they cannot define a global style. Now they will directly see the
correct indentation on every fresh clone of the project.
See https://editorconfig.org
Signed-off-by: Íñigo Huguet <ihuguet@...hat.com>
---
v2: added special rule for patch files so it doesn't remove
trailing whitespaces, making them unusable.
---
.editorconfig | 22 ++++++++++++++++++++++
.gitignore | 1 +
2 files changed, 23 insertions(+)
create mode 100644 .editorconfig
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000000000000..082d81bd0475
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,22 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.{c,h}]
+indent_style = tab
+indent_size = 8
+
+[{Makefile,Makefile.*,*.mk}]
+indent_style = tab
+indent_size = 8
+
+[*.{py,rs}]
+indent_style = space
+indent_size = 4
+
+[*.{patch,diff}]
+trim_trailing_whitespace = false
diff --git a/.gitignore b/.gitignore
index 70ec6037fa7a..c68f8f247379 100644
--- a/.gitignore
+++ b/.gitignore
@@ -105,6 +105,7 @@ modules.order
!.gitignore
!.mailmap
!.rustfmt.toml
+!.editorconfig
#
# Generated include files
--
2.39.2
Powered by blists - more mailing lists