From 092b20988d20c6e5df4afd7918f7c724a04626b6 Mon Sep 17 00:00:00 2001 From: Emil Ohlsson Date: Fri, 15 Nov 2024 14:59:54 +0100 Subject: [PATCH] Allow editorconfig to be used while coding The current .editorconfig does not set up the editor to the formatting used in the code files, and it is stated that this is to prevent conflict with formatter. The conflict isn't in the .editorconfig, it's in the use of .editorconfig as a formating check at the same time as clang-format. This change enables .editorconfig to be used by the editor, and disables the check for code files, which resolves the conflict. Signed-off-by: Emil Ohlsson --- .editorconfig | 8 ++++---- .pre-commit-config.yaml | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.editorconfig b/.editorconfig index 7e95757f..7019062b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -16,10 +16,6 @@ indent_style = space insert_final_newline = true trim_trailing_whitespace = true -# Avoid conflict with formatters. -[*.{c,h,cpp,hpp,md}] -indent_size = unset - # Override settings. [*.{json,yml,yaml}] indent_size = 2 @@ -28,6 +24,10 @@ indent_size = 2 [.clang-{tidy,format}] indent_size = 2 +# And md +[*.md] +indent_size = 2 + # Override settings. [LICENSES/*] indent_size = unset diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a57ecd80..5c64d759 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,14 @@ repos: alias: ec stages: [ pre-commit ] name: "EditorConfig Rules" - exclude: ^LICENSES/ + exclude: | + (?x)^( + LICENSES/.*| + .*\.c| + .*\.h| + .*\.cpp| + .*\.hpp + )$ - repo: https://github.com/cmake-lint/cmake-lint rev: 251239e56ab8b88889fec16a47376c44dfa16a99 hooks: -- GitLab