Skip to contentSkip to conversation

Add .editorconfig file for basic formatting

PATCH Superseded Íñigo Huguet 1 participant 1 message Feb 21, 2023

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 Vim and emacs.

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

---
 .editorconfig | 19 +++++++++++++++++++
 .gitignore    |  1 +
 2 files changed, 20 insertions(+)
 create mode 100644 .editorconfig
.editorconfig new file +19 -0
new file mode 100644
index 000000000000..0791a12a20f0
@@ -0,0 +1,19 @@
+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
.gitignore +1 -0
index 20dce5c3b9e0..6d09f3003484 100644
@@ -102,6 +102,7 @@ modules.order
 !.gitignore
 !.mailmap
 !.rustfmt.toml
+!.editorconfig
 
 #
 # Generated include files
Signature · 1 line
2.34.3