From 35383bc881f78332690cb5e347bf40358b156410 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Fri, 8 Nov 2024 16:37:18 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20formatting=20for=20c/c++?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The formatting commands incorrectly used [] instead of {} in the fd glob expression. This caused it to match only single characters instead of file extensions like cpp,cxx,hpp etc. --- CHANGELOG.md | 2 ++ c/make-derivation.nix | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 134a8cd..41af8a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Python's config merger now handles mypy overrides targeting multiple packages. +- C/C++ format commands used `[]` instead of `{}` in the fd glob + expression so it matched single chars. ## [5.0.0] - 2024-10-15 diff --git a/c/make-derivation.nix b/c/make-derivation.nix index 1687483..a0a00b9 100644 --- a/c/make-derivation.nix +++ b/c/make-derivation.nix @@ -106,7 +106,7 @@ let runHook preLint if [ -z "''${dontCheckClangFormat:-}" ]; then echo "🏟 Checking format in C/C++ files..." - ${buildPackages.fd}/bin/fd --ignore-file=.gitignore --glob '*.[h,hpp,hh,cpp,cxx,cc,c]' --exec-batch clang-format -Werror -n --style=LLVM + ${buildPackages.fd}/bin/fd --ignore-file=.gitignore --glob '*.{h,hpp,hh,cpp,cxx,cc,c}' --exec-batch clang-format -Werror -n --style=LLVM rc=$? if [ $rc -eq 0 ]; then @@ -129,7 +129,7 @@ let script = '' runHook preFormat echo "🏟️ Formatting C++ files..." - ${buildPackages.fd}/bin/fd --glob '*.[h,hpp,hh,cpp,cxx,cc,c]' --exec-batch clang-format --style=LLVM -i "$@" + ${buildPackages.fd}/bin/fd --glob '*.{h,hpp,hh,cpp,cxx,cc,c}' --exec-batch clang-format --style=LLVM -i "$@" runHook postFormat ''; description = "Format source code in the component.";