tools: add EditorConfig file
PATCH 1/1 tools: add EditorConfig file
EditorConfig is a file format and collection of text editor plugins for maintaining consistent coding styles between different editors and IDEs.
Initialize the file following the coding rules indoc/guides/contributing/coding_style.rst,doc/guides/contributing/documentation.rst anddoc/guides/contributing/patches.rst.
In order for this file to be taken into account (unless they use an editor with built-in EditorConfig support), developers will have to install a plugin.
Note: The max_line_length property is only supported by a limited number of EditorConfig plugins. It will be ignored if unsupported.
Add this new file in MAINTAINERS in the "Developers and Maintainers Tools" section.
--- .editorconfig | 23 +++++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 24 insertions(+) create mode 100644 .editorconfig
.editorconfig new file +23 -0
@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2019 6WIND S.A. + +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = tab +tab_width = 8 +max_line_length = 80 + +[**.py] +indent_style = space +indent_size = 4 + +[**.rst] +indent_style = space +indent_size = 3 + +[COMMIT_EDITMSG] +max_line_length = 72
MAINTAINERS +1 -0
@@ -82,6 +82,7 @@ F: doc/ Developers and Maintainers Tools M: Thomas Monjalon <[email protected]> +F: .editorconfig F: MAINTAINERS F: devtools/check-dup-includes.sh F: devtools/check-maintainers.sh
Signature · 1 line
2.23.0
Quoted 18 lines · Robin Jarry
EditorConfig is a file format and collection of text editor plugins for maintaining consistent coding styles between different editors and IDEs.
Initialize the file following the coding rules in
doc/guides/contributing/coding_style.rst,doc/guides/contributing/documentation.rstanddoc/guides/contributing/patches.rst.In order for this file to be taken into account (unless they use an editor with built-in EditorConfig support), developers will have to install a plugin.
Note: The
max_line_lengthproperty is only supported by a limited number of EditorConfig plugins. It will be ignored if unsupported.Add this new file in
MAINTAINERSin the "Developers and Maintainers Tools" section.
Quoted 7 lines
Cc Thomas Monjalon <[email protected]>Signed-off-by Robin Jarry <[email protected]>---
+1, we need things like this. It would also be good to finally get a .clang-format file...
Signature · 2 lines
Thanks, Anatoly
On Fri, 18 Oct 2019 09:59:54 +0200
Robin Jarry <[email protected]> wrote:
Looks good, you should add a reference to
https://editorconfig.org so others understand this
Quoted 6 lines
.editorconfig new file +6
-0+# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2019 6WIND S.A. + +root = true + +[*]
.editorconfig line 16
Quoted 10 lines
.editorconfig new file +10
-0+end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = tab +tab_width = 8 +max_line_length = 80 + +[**.py] +indent_style = space +indent_size = 4
In the example on web site, they use
[*.py] not [**.py]
2019-10-18, Stephen Hemminger:
Quoted 2 lines
In the example on web site, they use
[*.py] not [**.py]
I've tested both forms, they work the same. I don't have a strong opinion on this, I can change to [*.py].
Signature · 1 line
Robin
Quoted 8 lines · On Fri, 18 Oct 2019 09:59:54 +0200 Robin Jarry <[email protected]> wrote:
.editorconfig new file +2
-0@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2019 6WIND S.A.
.editorconfig line 12
Quoted 10 lines
.editorconfig new file +10
-0+ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = tab +tab_width = 8 +max_line_length = 80
Why not add this (since git doesn't like trailing whitespace).
trim_trailing_whitespace=true
2019-10-18, Stephen Hemminger:
Quoted 3 lines
Why not add this (since git doesn't like trailing whitespace).
trim_trailing_whitespace=true
Because EditorConfig applies the setting to the whole file when saving. This has chances of trimming white space on lines that you did not modify. I figure this is not what we want.
Signature · 1 line
Robin
Quoted 9 lines · On Fri, 18 Oct 2019 17:56:48 +0200 Robin Jarry <[email protected]> wrote:
2019-10-18, Stephen Hemminger:
Quoted 3 lines
Why not add this (since git doesn't like trailing whitespace).
trim_trailing_whitespace=true
Because EditorConfig applies the setting to the whole file when saving. This has chances of trimming white space on lines that you did not modify. I figure this is not what we want.
Current DPDK does not have trailing white space, I run a script over it perodically to check.
Quoted 8 lines · Stephen Hemminger
Quoted 5 lines · On Fri, 18 Oct 2019 17:56:48 +0200 Robin Jarry <[email protected]> wrote:
2019-10-18, Stephen Hemminger:
Quoted 3 lines
Why not add this (since git doesn't like trailing whitespace).
trim_trailing_whitespace=true
Quoted 8 lines
Quoted 4 lines
Because EditorConfig applies the setting to the whole file when saving. This has chances of trimming white space on lines that you did not modify. I figure this is not what we want.
Current DPDK does not have trailing white space, I run a script over it perodically to check.
+1 for including this.
PATCH v2 1/1 devtools: add EditorConfig file
In reply to Robin JarryEditorConfig is a file format and collection of text editor plugins for maintaining consistent coding styles between different editors and IDEs.
Initialize the file following the coding rules indoc/guides/contributing/coding_style.rst,doc/guides/contributing/documentation.rst anddoc/guides/contributing/patches.rst.
In order for this file to be taken into account (unless they use an editor with built-in EditorConfig support), developers will have to install a plugin.
Note: The max_line_length property is only supported by a limited number of EditorConfig plugins. It will be ignored if unsupported.
Add this new file in MAINTAINERS in the "Developers and Maintainers Tools" section.
---
Changelog:
v2:
- Add link to editorconfig.org in file for syntax reference.
- Use [*.EXT] syntax for section headers (as shown on home page).
- Add trim_trailing_whitespace option.
.editorconfig | 25 +++++++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 26 insertions(+) create mode 100644 .editorconfig
.editorconfig new file +25 -0
@@ -0,0 +1,25 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2019 6WIND S.A. +# See https://editorconfig.org/ for syntax reference. + +root = true + +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +charset = utf-8 +indent_style = tab +tab_width = 8 +max_line_length = 80 + +[*.py] +indent_style = space +indent_size = 4 + +[*.rst] +indent_style = space +indent_size = 3 + +[COMMIT_EDITMSG] +max_line_length = 72
MAINTAINERS +1 -0
@@ -82,6 +82,7 @@ F: doc/ Developers and Maintainers Tools M: Thomas Monjalon <[email protected]> +F: .editorconfig F: MAINTAINERS F: devtools/check-dup-includes.sh F: devtools/check-maintainers.sh
--
2.23.0
Thomas Monjalon
AppliedRe: [dpdk-dev] [PATCH v2] devtools: add EditorConfig file
25/10/2019 16:04, Robin Jarry:
Quoted 29 lines
EditorConfig is a file format and collection of text editor plugins for maintaining consistent coding styles between different editors and IDEs.
Initialize the file following the coding rules in
doc/guides/contributing/coding_style.rst,doc/guides/contributing/documentation.rstanddoc/guides/contributing/patches.rst.In order for this file to be taken into account (unless they use an editor with built-in EditorConfig support), developers will have to install a plugin.
Note: The
max_line_lengthproperty is only supported by a limited number of EditorConfig plugins. It will be ignored if unsupported.Add this new file in
MAINTAINERSin the "Developers and Maintainers Tools" section.Cc Thomas Monjalon <[email protected]>Cc Stephen Hemminger <[email protected]>Cc Anatoly Burakov <[email protected]>Cc Keith Wiles <[email protected]>Cc Ray Kinsella <[email protected]>Cc Andrew Rybchenko <[email protected]>Signed-off-by Robin Jarry <[email protected]>
Quoted 8 lines
---
Changelog:v2:
- Add link to editorconfig.org in file for syntax reference.
- Use [*.EXT] syntax for section headers (as shown on home page).
- Addtrim_trailing_whitespaceoption.
This patch was forgotten, sorry.
Applied, thanks it looks to be a good addition.