From 57ec84fcc709bf6f0fea6eb2b83c1de8fe329237 Mon Sep 17 00:00:00 2001 From: HEMASHREE N Date: Mon, 11 May 2026 04:30:32 +0530 Subject: [PATCH] docs: clarify clang-format version and usage (#474) * docs: clarify clang-format version and usage Added version, installation, and verification steps for clang-format to help contributors avoid CI issues. * Enhance CONTRIBUTING.md with installation details Updated installation instructions for clang-format on Ubuntu/Debian and Arch Linux. Added details for verifying installation and modified commands to include additional directories. * Revise clang-format installation instructions Updated installation instructions for clang-format and removed redundant verification section. * Enhance clang-format usage instructions in CONTRIBUTING.md Added recommendations for using clang-format before PR submission to ensure proper code formatting. * Update CONTRIBUTING.md with clang18 PATH instructions Add instructions to set PATH for clang18 on Arch Linux --- CONTRIBUTING.md | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 132b7ec..4016173 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,6 +41,45 @@ Running `clang-format` locally is recommended before submitting a PR as it will Either way, just ensure you manually review automatic changes. +### Version + +This project currently uses **clang-format version 18**. + +Please ensure you are using this version to avoid CI formatting failures. + +### Installation + +
+Install on Ubuntu / Debian + +```bash +sudo apt install clang-format +``` + +
+ +
+Install on Arch Linux + +```bash +sudo pacman -S clang18 + +# Add to PATH via 'profile.d' +echo 'export PATH="/usr/lib/llvm18/bin:${PATH}"' | sudo tee /etc/profile.d/clang-format-18.sh +``` + +
+ +### Verify Installation + +You can check your installed version using: + +```bash +clang-format --version +``` + +Ensure the output shows version 18. + #### VSCode The recommended setup for VSCode is to install the [**clangd**](https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd) extension. It will provide helpful information in VSCode and can be used to format the code automatically according to the `.clang-format` file with **`Ctrl+Shift+I`** @@ -53,9 +92,11 @@ If installed locally and you'd prefer to use it in your shell. You can do the fo ```sh # List warnings -clang-format --dry-run -Werror include/*.h source/*.c +clang-format --dry-run -Werror include/*.h include/game/*.h source/*.c source/game/*.c + # Modify all files inplace -clang-format -i include/*.h source/*.c +clang-format -i include/*.h include/game/*.h source/*.c source/game/*.c + # Or just one clang-format -i include/blind.h ```