File indexing completed on 2024-05-19 05:42:35
0001 #!/bin/bash 0002 0003 EXEC=clazy 0004 BUILD_DIR=build 0005 COMPILE_COMMANDS_JSON="$BUILD_DIR/compile_commands.json" 0006 PARALLEL=parallel 0007 0008 TARGET_DIRS="$*" 0009 0010 pr_err() 0011 { 0012 echo "ERROR: $*" 1>&2 0013 } 0014 0015 fatal() 0016 { 0017 pr_err "$*" 0018 exit 1 0019 } 0020 0021 if ! [ -d "$BUILD_DIR" ]; then 0022 fatal "$BUILD_DIR is not a directory" 0023 fi 0024 0025 if ! [ -f "$COMPILE_COMMANDS_JSON" ]; then 0026 fatal "$COMPILE_COMMANDS_JSON not found" 0027 fi 0028 0029 TARGET_FILES= 0030 0031 for dir in $TARGET_DIRS; do 0032 if ! [ -d "$dir" ]; then 0033 fatal "$dir not found" 0034 fi 0035 0036 for file in "$dir"/*.cpp "$dir"/*.h; do 0037 if [[ ! "$file" =~ .*\.t.cpp$ ]]; then 0038 TARGET_FILES="$TARGET_FILES $file" 0039 fi 0040 done 0041 done 0042 0043 # deglobbing $TARGET_FILES is intentional 0044 # shellcheck disable=SC2086 0045 if [ "$CLAZY_SERIAL" != "" ]; then 0046 echo "Running in serial" 0047 set -x 0048 "$EXEC" --standalone --ignore-included-files -p "$BUILD_DIR" --extra-arg=-Wno-unknown-warning-option $TARGET_FILES 0049 else 0050 echo "Running in parallel (default)" 0051 set -x 0052 "$PARALLEL" "$EXEC" --standalone --ignore-included-files -p "$BUILD_DIR" --extra-arg=-Wno-unknown-warning-option -- $TARGET_FILES 0053 fi