[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241116030802.1267075-2-mailhol.vincent@wanadoo.fr>
Date: Sat, 16 Nov 2024 12:05:43 +0900
From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
To: netdev@...r.kernel.org,
Stephen Hemminger <stephen@...workplumber.org>,
David Ahern <dsahern@...il.com>
Cc: Vincent Mailhol <mailhol.vincent@...adoo.fr>
Subject: [PATCH iproute2-next v2] add .editorconfig file for basic formatting
EditorConfig is a specification to define the most basic code formatting
stuff, and it is 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 configurations to *.{c,h}, *.json or *.yaml.
In linux related projects, defining a .editorconfig might help 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.
Add the .editorconfig file at the root of the iproute2 project with a broad
generic configuration for all file types. Then add exceptions for the file
types which follow different conventions.
See https://editorconfig.org
Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
---
For reference, here is the .editorconfig of the kernel:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/.editorconfig
** Changelog **
v1 -> v2
- remove *.yaml configuration as there are no such files in the
iproute2 project.
- factorize common configurations under the default [*] category.
- add back the trim_trailing_whitespace option.
- add back the max_line_length option: 100 columns per default, 75
columns for commit messages and patches.
Link: https://lore.kernel.org/netdev/20241115151030.1198371-2-mailhol.vincent@wanadoo.fr/
---
.editorconfig | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 .editorconfig
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..97e961b9
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-2.0
+
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+indent_size = 8
+indent_style = tab
+insert_final_newline = true
+max_line_length = 100
+tab_width = 8
+trim_trailing_whitespace = true
+
+[*.json]
+indent_style = space
+indent_size = 4
+
+[{COMMIT_EDITMSG,*.patch}]
+max_line_length = 75
--
2.45.2
Powered by blists - more mailing lists