Skip to content

Commit

Permalink
Tools: git ls-files to find files to check style
Browse files Browse the repository at this point in the history
  • Loading branch information
julianoes authored and davids5 committed May 3, 2021
1 parent 9ca5532 commit 30b8890
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
5 changes: 4 additions & 1 deletion Tools/check_code_style_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ if [ ! -f $HOOK_FILE ] && [ "$CI" != "true" ]; then
fi
fi

${DIR}/files_to_check_code_style.sh | xargs -n 1 -P 8 -I % ${DIR}/check_code_style.sh %
for F in $(${DIR}/files_to_check_code_style.sh)
do
${DIR}/check_code_style.sh $F
done

if [ $? -eq 0 ]; then
echo "Format checks passed"
Expand Down
13 changes: 4 additions & 9 deletions Tools/files_to_check_code_style.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
#!/usr/bin/env bash
set -eu

PATTERN="-e ."
ENDINGS="\.c$\|\.h$\|\.cpp$\|\.hpp$"

if [ $# -gt 0 ]
then
PATTERN="$1"
exec git ls-files | grep $ENDINGS | grep - F "$1"
else
exec git ls-files | grep $ENDINGS
fi

exec find . \
-path ./libopencm3 -prune -o \
-path ./lib -prune -o \
-path ./monocypher -prune -o \
-path "./gcc-arm-none-eabi-*" -prune -o \
-type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) | grep $PATTERN

0 comments on commit 30b8890

Please sign in to comment.