Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] .editorconfig: add editor-agnostic configuration
@ 2023-10-31 13:40 yann.morin
  2023-11-01 21:54 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: yann.morin @ 2023-10-31 13:40 UTC (permalink / raw)
  To: buildroot; +Cc: yann.morin

From: "Yann E. MORIN" <yann.morin@orange.com>

EditorConfig [0] is an editor-agnostic configuration file, to set
preferences on how to edit text: tabs vs. spaces, tab width, indentation
size, line endings...

A large number of editors support EditorConfig, either natively [1] or
with the help of plugins [2].

Add a basic .editorconfig that provides defaults for most of the files
used by Buildroot. More can be added in the future if we can find more
matching patterns.

The values are chosen a bit arbitrarily, unless we already have a
(un)written rule about it. Notably, indentation defaults to using 4
spaces, and only a set of files for which we require TABs (Makefile,
essentially) or have already settled for TABs (Kconfig files, init
scripts...) are configured so. The traditional width of TABs is 8 char,
and we pair TAB indentation with TAB size.

Trailing spaces are usually useless, except in asciidoc source where
they can be used to force a new line without a new paragraph.

One of the limitations of .editorconfig, tough, is that it matches on
filenames (e.g. *.py), not on the content (e.g. no use of mimetype, or
libmagic, or such). Still, this is enough to cover a lot of files in
Buildroot.

[0] https://editorconfig.org/
[1] https://editorconfig.org/#pre-installed
[2] https://editorconfig.org/#download

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
---
 .editorconfig | 29 +++++++++++++++++++++++++++++
 DEVELOPERS    |  1 +
 2 files changed, 30 insertions(+)
 create mode 100644 .editorconfig

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000000..4acaf3486b
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,29 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+indent_style = space
+indent_size = 4
+tab_width = 8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[DEVELOPERS]
+indent_style = tab
+indent_size = tab
+
+[{Config*.in*,linux/Config.ext.in}]
+indent_style = tab
+indent_size = tab
+
+[{Makefile*,*.mk}]
+indent_style = tab
+indent_size = tab
+
+[S{0..9}{0..9}*]
+indent_style = tab
+indent_size = tab
+
+[*.adoc]
+trim_trailing_whitespace = false
diff --git a/DEVELOPERS b/DEVELOPERS
index 57015e245e..e180755fe4 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -3169,6 +3169,7 @@ F:	package/zisofs-tools/
 F:	support/download/
 
 N:	Yann E. MORIN <yann.morin@orange.com>
+F:	.editorconfig
 F:	package/gpsd/
 
 N:	Yegor Yefremov <yegorslists@googlemail.com>
-- 
2.34.1

____________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-01 21:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31 13:40 [Buildroot] [PATCH] .editorconfig: add editor-agnostic configuration yann.morin
2023-11-01 21:54 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox