Skip to contentSkip to conversation

introduce .editorconfig

PATCH In review Dzmitry Sankouski 2 participants 3 messages Mar 3, 2023

lore
Share & tools
lore
#0 lore raw

v3 cover introduce .editorconfig

Current process of sending patches includes running checkpatch.pl script for each patch, and fixing found style problems. Editorconfig may help to prevent some style related problems (like spaces vs tab indentation) on the fly.

Changes in v3:
- add 'the' article in docs
- fix spacing
- add sign off tag

Changes in v2:
- add section in coding style rst doc
- unify Kconfig with other files

Dzmitry Sankouski (1):
editorconfig: introduce .editorconfig

 .editorconfig               | 15 +++++++++++++++
 .gitignore                  |  1 +
 doc/develop/codingstyle.rst |  4 ++++
 3 files changed, 20 insertions(+)
 create mode 100644 .editorconfig
Signature · 1 line
2.30.2
#1 lore raw

PATCH v3 1/1 editorconfig: introduce .editorconfig

Current process of sending patches includes running checkpatch.pl script for each patch, and fixing found style problems. EditorConfig may help to prevent some style related problems (like spaces vs tab indentation) on the fly.

---

Changes in v3:
- add 'the' article in docs
- fix spacing
- add sign off tag

Changes in v2:
- add section in coding style rst doc
- unify Kconfig with other files

 .editorconfig               | 15 +++++++++++++++
 .gitignore                  |  1 +
 doc/develop/codingstyle.rst |  4 ++++
 3 files changed, 20 insertions(+)
 create mode 100644 .editorconfig
.editorconfig new file +15 -0
new file mode 100644
index 0000000000..df69cee160
@@ -0,0 +1,15 @@
+; This file is for unifying the coding style for different editors and IDEs.
+; Plugins are available for notepad++, emacs, vim, gedit,
+; textmate, visual studio, and more.
+;
+; See http://editorconfig.org for details.
+
+# Top-most EditorConfig file.
+root = true
+
+[{**.c, **.h, **Kconfig}]
+indent_style = tab
+indent_size = 8
+end_of_line = lf
+trim_trailing_whitespace = true
+insert_final_newline = true
.gitignore +1 -0
index 3a4d056edf..ed8ca226fe 100644
@@ -7,6 +7,7 @@
 #
 .*
 !.checkpatch.conf
+!.editorconfig
 *.a
 *.asn1.[ch]
 *.bin
doc/develop/codingstyle.rst +4 -0
index 1d5d0192b3..0bbac75d4e 100644
@@ -27,6 +27,10 @@ The following rules apply:
   more information, read :doc:`checkpatch`. Note that this should be done
   *before* posting on the mailing list!
 
+* Some code style rules may be applied automatically by your editor using
+  the EditorConfig tool. Feel free to setup your editor to work with u-boot's
+  .editorconfig.
+
 * Source files originating from different projects (for example the MTD
   subsystem or the hush shell code from the BusyBox project) may, after
   careful consideration, be exempted from these rules. For such files, the
Signature · 1 line
2.30.2
#2 lore raw

Re: [PATCH v3 1/1] editorconfig: introduce .editorconfig

Quoted 36 lines · Dzmitry Sankouski

Current process of sending patches includes running checkpatch.pl script for each patch, and fixing found style problems. EditorConfig may help to prevent some style related problems (like spaces vs tab indentation) on the fly.

---

Changes in v3:
- add 'the' article in docs
- fix spacing
- add sign off tag

Changes in v2:
- add section in coding style rst doc
- unify Kconfig with other files

  .editorconfig               | 15 +++++++++++++++
  .gitignore                  |  1 +
  doc/develop/codingstyle.rst |  4 ++++
  3 files changed, 20 insertions(+)

create mode 100644 .editorconfig

.editorconfig new file +5 -0
new file mode 100644
index 0000000000..df69cee160
@@ -0,0 +1,15 @@
+; This file is for unifying the coding style for different editors and IDEs.
+; Plugins are available for notepad++, emacs, vim, gedit,
+; textmate, visual studio, and more.
+;
+; See http://editorconfig.org for details.

.editorconfig line 15

Quoted 10 lines
.editorconfig new file +10 -0
+
+# Top-most EditorConfig file.
+root = true
+
+[{**.c, **.h, **Kconfig}]
+indent_style = tab
+indent_size = 8
+end_of_line = lf
+trim_trailing_whitespace = true
+insert_final_newline = true

For Python we follow PEP8 and use 4 spaces per indent. We use the same for *.rst. Could you, please, add such a rule (possibly in a follow up patch).

.gitignore line 10

Quoted 9 lines
.gitignore +1 -0
index 3a4d056edf..ed8ca226fe 100644
@@ -7,6 +7,7 @@
  #
  .*
  !.checkpatch.conf
+!.editorconfig

Why would you want to ignore the file?

Best regards

Heinrich

Quoted 18 lines
.gitignore +0 -0
  *.a
  *.asn1.[ch]
  *.bin
doc/develop/codingstyle.rst +4 -0
index 1d5d0192b3..0bbac75d4e 100644
@@ -27,6 +27,10 @@ The following rules apply:
    more information, read :doc:`checkpatch`. Note that this should be done
    *before* posting on the mailing list!
 
+* Some code style rules may be applied automatically by your editor using
+  the EditorConfig tool. Feel free to setup your editor to work with u-boot's
+  .editorconfig.
+
  * Source files originating from different projects (for example the MTD
    subsystem or the hush shell code from the BusyBox project) may, after
    careful consideration, be exempted from these rules. For such files, the