2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-21 17:37:37 +00:00

editorconfig: Remove [*] section and trim_trailing_whitespace.

Wildcard sections [*] and [**] are unsafe because properties cannot be
applied safely to any filetype in general. For example, IDEs like
Visual Studio Code and KDevelop store configuration files in subfolders
like .vscode or .kdev4. Properties from wildcard sections also apply to
those files which is not safe in general.
Another example are patches created with 'git format-patch' which can
contain trailing whitespaces. When editing a patch, e.g. to fix a typo
in the title, trailing whitespaces should not be removed.

Property trim_trailing_whitespace should not be defined at all because
it is interpreted differently by editors. Some wipe whitespaces from
the whole file, others remove them from edited lines only and a few
change their behavior between releases [0]. Limiting the property to a
subset of files like *.c/*.h will not mitigate the issue:

Multiple definitions of a whitespace exist. Unicode considers a form
feed (0x0C) to be a whitespace [1]. QChar::isSpace() [2] from Qt
follows this definition, causing the Kate editor identify a form feed
as a trailing whitespace and removing it from sources [3]. This breaks
patches when editors remove form feeds and thus causing broken patches
which cannot be applied cleanly.

Removing trim_trailing_whitespace will be a minor inconvienence, in
particular because utilities/checkpatch.py and thus 0-day Robot will
prevent trailing whitespaces for our definition of a whitespace.

[0] 94b328fc64
[1] https://en.wikipedia.org/wiki/Whitespace_character
[2] 5628600a07/src/corelib/text/qchar.h (L554)
[3] 10210ec1dd/src/document/katedocument.cpp (L5643)

Fixes: 07f6d6a0cb51 ("Add editorconfig file.")

Signed-off-by: Jakob Meng <code@jakobmeng.de>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-by: Robin-Jarry <rjarry@redhat.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
This commit is contained in:
Jakob Meng 2023-10-27 14:10:40 +02:00 committed by Aaron Conole
parent 8b5fe2dc60
commit 20022fbf5a

View File

@ -2,15 +2,18 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
# No wildcard sections [*] and [**] because properties cannot be
# applied safely to any filetype in general.
# Property trim_trailing_whitespace should not be defined at all
# because it is interpreted differently by editors.
[*.{c,h}]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
max_line_length = 79
[include/linux/**.h]