Skip to content
Snippets Groups Projects

add script to check clang-format without parallel command

Closed Tobias Arens requested to merge 445-check-format-script-windows into master
1 file
+ 28
0
Compare changes
  • Side-by-side
  • Inline
+ 28
0
#! /bin/bash
##########################
#
# This script uses clang-format to output code snippets,
# that do not match the provided format specifications.
# In contrast to the chech-format-cpp.sh script, it does not use the 'parallel' command,
# which does not work on windows (git bash)
#
###########################
set -e
origin=$(dirname "$(readlink -f "$0")")
files=$(find "$(readlink -f "${origin}"/../src)" -type f -regex "^.*\.\(hpp\|cpp\|h\|c\)$")
files+=$'\n'$(find "$(readlink -f "${origin}"/../include)" -type f -regex "^.*\.\(hpp\|cpp\|h\|c\)$")
files+=$'\n'$(find "$(readlink -f "${origin}"/../tests)" -type f -regex "^.*\.\(hpp\|cpp\|h\|c\)$")
for file in $files
do
clang-format --dry-run -Werror $file &
if [[ $? -ne 0 ]]
then
exit
fi
done
\ No newline at end of file
Loading