scripts/format: only format git-tracked files
What changed, and why it matters
This commit changes a code-formatting helper script so it only processes files tracked by Git, instead of scanning every file in the source directories. The old behavior accidentally formatted files inside build/cache folders such as src/rust/target, which only made the script slower. There is no security issue here.
No security action needed. This is a routine developer-tooling change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The scripts/format script is updated to use git ls-files src test | grep -E '\.(c|h)$' with explicit exclude filters, replacing a find command that pruned certain paths but still traversed untracked/generated directories. This is a tooling/performance improvement with no functional or security impact on the firmware.
Changed components
scripts/formatInspect captured patch +6 / −8
diff --git a/scripts/format b/scripts/format
index fb1c2a7..5f5a959 100755
--- a/scripts/format
+++ b/scripts/format
@@ -15,14 +15,12 @@ VERBOSE=${VERBOSE:-NO}
command -v ${CLANGFORMAT} >/dev/null 2>&1 || { echo >&2 "${CLANGFORMAT} is missing"; exit 1; }
# TODO: Put all external code in "external"
-FILES=$(find src/ test/ \
- \( \
- -path src/ui/fonts -o \
- -path external/vendor -o \
- -path src/rust/bitbox-secp256k1/depend -o \
- -path src/rust/fatfs-sys/depend -o \
- -name "ugui*" \
- \) -prune -o \( -name "*.c" -o -name "*.h" \) -print)
+FILES=$(git ls-files src test | \
+ grep -E '\.(c|h)$' | \
+ grep -v -E '^src/ui/fonts/' | \
+ grep -v -E '^src/rust/bitbox-secp256k1/depend/' | \
+ grep -v -E '^src/rust/fatfs-sys/depend/' | \
+ grep -v -E '/ugui')
if [ "${VERBOSE}" != "NO" ] ; then
echo ${FILES}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.