It is perfectly valid for a patch file to have trailing spaces, when for
example an empty or space-only line is appears in a hunk: if the line if
part of the context, whether it be empty or with only spaces, there will
aways be the leading space introduced by the patch itsef, making for a
sapce-only line; if the line is space-only and removed (or added) that
will also appear as a space-only line.
Currently, our editorconfig wants to unconditionally drop trailing
spaces, so when one edits a patch file to add their SoB and Upstream
tags, such a patch would get badly mangled and would not apply, causing
quite some grief and questioning (sad experience looming in the recent
past here)...
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
(cherry picked from commit 85736a27c8)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
It turns out that wildcard expansion, * and ?, is not performed in
matching lists {...}, at least in the vim plugin. The spec is not clear
about that, but refer to "pattern matching through Unix shell-style
wildcards" [0].
So, let's consider that this is not supported. Expand the patterns into
one section each, rather than use a list.
[0] https://spec.editorconfig.org/
Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.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, though, 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>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>