this is a differenet branch so this can be the commit message

This commit is contained in:
2025-07-21 20:41:56 -04:00
parent d8f1d59c30
commit 26790f3f91
4 changed files with 77 additions and 58 deletions

36
tools/Cleanup Normal file
View File

@@ -0,0 +1,36 @@
#!/bin/env bash
# Usage: ./Cleanup [FILE]...
lint_file() {
cppcheck --enable=all --quiet "$1"
}
whitespace_cleanup() {
sed -i 's/[ \t]*$//' "$1"
awk 'BEGIN{ORS=""} {print $0 "\n"} END{}' "$1" > "$1.tmp" && mv "$1.tmp" "$1"
}
comment_check() {
if grep -n -E 'TODO|FIXME' "$1"; then
echo "[WARN] $1 contains TODO/FIXME comments."
fi
}
process_file() {
clang-format -i "$1"
tools/check_header_footer "$1"
lint_file "$1"
whitespace_cleanup "$1"
comment_check "$1"
}
if [[ $# -gt 0 ]]; then
for file in "$@"; do
process_file "$file"
done
else
for file in $(find yait core -type f \( -name "*.c" -o -name "*.h" \)); do
process_file "$file"
done
fi