summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHui Min Mina Chou <[email protected]>2024-09-16 17:56:36 +0800
committerAnup Patel <[email protected]>2024-11-06 16:25:37 +0530
commit369c64517ee5c2753a33a5ff7695b4d2b6066e7b (patch)
treebdc736918a2e113ba6d96421ecb970482684b388
parent9782b8847dabe910d1584d79a6e1701111951354 (diff)
top: Add .editorconfig to set basic coding styles
EditorConfig [1] ensures consistent coding styles for developers collaborating on the same project across various editors and IDEs. By adopting the Linux project's .editorconfig settings [2] and applying them to OpenSBI, it helps users maintain uniform indentation across different IDEs and version control systems, improving development efficiency. The main difference from Linux project is the addition of 'trim_trailing_whitespace = true', which removes trailing whitespace before newlines. This change affects only three files in OpenSBI, but it improves overall code consistency. $ grep -nr "\s$" --include={*.{c,dts,h,lds,ldS,mk,s,S.py},Kconfig,Makefile,Makefile.*} . ./include/sbi_utils/fdt/fdt_fixup.h:4: * Implement platform specific DT fixups on top of libfdt. ./platform/generic/platform.c:79: * The fw_platform_coldboot_harts_init() function is called by fw_platform_init() ./platform/generic/platform.c:81: * according to the DT property "cold-boot-harts" in "/chosen/opensbi-config" Link: https://editorconfig.org/ [1] Link: https://lore.kernel.org/lkml/[email protected]/T/ [2] Signed-off-by: Hui Min Mina Chou <[email protected]> Reviewed-by: Anup Patel <[email protected]>
-rw-r--r--.editorconfig21
-rw-r--r--.gitignore1
2 files changed, 22 insertions, 0 deletions
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..e66b1ca3
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: GPL-2.0-only
+# See here for more information about the format and editor support:
+# https://editorconfig.org/
+
+root = true
+
+[{*.{c,dts,h,lds,ldS,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
+
+[*.py]
+charset = utf-8
+end_of_line = lf
+trim_trailing_whitespace = true
+insert_final_newline = true
+indent_style = space
+indent_size = 4
diff --git a/.gitignore b/.gitignore
index a519d67f..424302b3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
!.clang-format
!.gitignore
!.github
+!.editorconfig
# Object files
*.o