mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 00:35:01 +00:00
Add .editorconfig file for basic formatting
EditorConfig is a specification to define the most basic code formatting stuff, and it's supported by many editors and IDEs, either directly or via plugins, including VSCode/VSCodium, Vim, emacs and more. It allows to define formatting style related to indentation, charset, end of lines and trailing whitespaces. It also allows to apply different formats for different files based on wildcards, so for example it is possible to apply different configs to *.{c,h}, *.py and *.rs. In linux project, defining a .editorconfig might help to those people that work on different projects with different indentation styles, so they cannot define a global style. Now they will directly see the correct indentation on every fresh clone of the project. See https://editorconfig.org Co-developed-by: Danny Lin <danny@kdrag0n.dev> Signed-off-by: Danny Lin <danny@kdrag0n.dev> Signed-off-by: Íñigo Huguet <ihuguet@redhat.com> Acked-by: Mickaël Salaün <mic@digikod.net> Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Tested-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
ac14947c77
commit
5a602de997
32
.editorconfig
Normal file
32
.editorconfig
Normal file
@ -0,0 +1,32 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
root = true
|
||||
|
||||
[{*.{awk,c,dts,dtsi,dtso,h,mk,s,S},Kconfig,Makefile,Makefile.*}]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
|
||||
[*.{json,py,rs}]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
# this must be below the general *.py to overwrite it
|
||||
[tools/{perf,power,rcu,testing/kunit}/**.py,]
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
|
||||
[*.yaml]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = unset
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -96,6 +96,7 @@ modules.order
|
||||
#
|
||||
!.clang-format
|
||||
!.cocciconfig
|
||||
!.editorconfig
|
||||
!.get_maintainer.ignore
|
||||
!.gitattributes
|
||||
!.gitignore
|
||||
|
@ -66,6 +66,10 @@ for aligning variables/macros, for reflowing text and other similar tasks.
|
||||
See the file :ref:`Documentation/process/clang-format.rst <clangformat>`
|
||||
for more details.
|
||||
|
||||
Some basic editor settings, such as indentation and line endings, will be
|
||||
set automatically if you are using an editor that is compatible with
|
||||
EditorConfig. See the official EditorConfig website for more information:
|
||||
https://editorconfig.org/
|
||||
|
||||
Abstraction layers
|
||||
******************
|
||||
|
@ -735,6 +735,10 @@ for aligning variables/macros, for reflowing text and other similar tasks.
|
||||
See the file :ref:`Documentation/process/clang-format.rst <clangformat>`
|
||||
for more details.
|
||||
|
||||
Some basic editor settings, such as indentation and line endings, will be
|
||||
set automatically if you are using an editor that is compatible with
|
||||
EditorConfig. See the official EditorConfig website for more information:
|
||||
https://editorconfig.org/
|
||||
|
||||
10) Kconfig configuration files
|
||||
-------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user