From 2ba244dd9c71a6697e8618dd2e9ee92bf0328989 Mon Sep 17 00:00:00 2001 From: Manuel Barrio Linares Date: Mon, 22 Dec 2025 00:05:10 -0300 Subject: [PATCH] Split formatting options out of .clang-tidy into .clang-format This splits out the .clang-format settings from the .clang-tidy file. Right now, the .clang-tidy file has a bit of a mix: it contains both clang-tidy checks and clang-format style options. This actually works fine in some tools (like CLion which doesn't completely fail), but newer versions of clangd-based tools (VSCode, Neovim, etc.) are stricter and will outright reject the config because they expect .clang-tidy to only contain tidy-related stuff. So here's what I did: - Moved all the formatting-related options into a brand new .clang-format file - Kept .clang-tidy focused only on checks, warnings-as-errors, and any check-specific options No changes to the actual style rules or tidy checks. Everything should behave exactly the same as before. This should now play nicely with clangd, VSCode/VSCodium, Neovim, and other modern clang-based tools, while still working perfectly in CLion. I did this because some/*my* PRs had some formatting errors that could be prevented in the future, thus lessing the work while reviewing/merging. Test the old .clang-tidy with ``` clang-tidy --dump-config ./.clang-tidy:13:1: error: unknown key 'SpaceBeforeCaseColon' ... more errors ``` Signed-off-by: Manuel Barrio Linares --- .clang-format | 15 +++++++++++++++ .clang-tidy | 16 +--------------- 2 files changed, 16 insertions(+), 15 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..d5e3ac648 --- /dev/null +++ b/.clang-format @@ -0,0 +1,15 @@ +IndentWidth: 4 +UseCRLF: false +IndentCaseLabels: true +UseTab: ForIndentation +TabWidth: 4 +BreakBeforeBraces: Allman +AllowShortBlocksOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: WithoutElse +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeParens: ControlStatementsExceptControlMacros +SpacesInCStyleCastParentheses: false +SpacesInConditionalStatement: false +SpacesInParentheses: false +SpacesInSquareBrackets: false diff --git a/.clang-tidy b/.clang-tidy index 4409189e0..912410670 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,21 +1,7 @@ --- # Configure clang-tidy for this project. -IndentWidth: 4 -UseCRLF: false -IndentCaseLabels: true -UseTab: UT_ForIndentation -TabWidth: 4 -BreakBeforeBraces: Allman -AllowShortBlocksOnASingleLine: SBS_Empty -AllowShortIfStatementsOnASingleLine: SIS_WithoutElse -SpaceBeforeAssignmentOperators: true -SpaceBeforeCaseColon: false -SpaceBeforeParens: SBPO_ControlStatementsExceptControlMacros -SpacesInCStyleCastParentheses: false -SpacesInConditionalStatement: false -SpacesInParentheses: false -SpacesInSquareBrackets: false + # Disabled: # -google-readability-namespace-comments the *_CLIENT_NS is a macro, and