Skip to content

Commit

Permalink
chore(dev): run clang-format on test files
Browse files Browse the repository at this point in the history
  • Loading branch information
jnooree committed Nov 10, 2023
1 parent 72b842a commit 656d3d0
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions scripts/run_clang_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,23 @@ done

shift $((OPTIND - 1))

files="$(mktemp)"
trap 'rm -f "$files"' INT TERM EXIT
tmpd="$(mktemp -d)"
trap 'rm -rf "$tmpd"' INT TERM EXIT

if [[ $# -eq 0 ]]; then
find include src python/nuri \
\( -iname '*.h' -o -iname '*.hpp' -o -iname '*.cpp' \) -print0 >"$files"
\( -iname '*.h' -o -iname '*.hpp' -o -iname '*.cpp' \) -print0 \
>"$tmpd/tidy-checks"

cp "$tmpd/tidy-checks" "$tmpd/format-checks"

find test \( -iname '*.h' -o -iname '*.hpp' -o -iname '*.cpp' \) -print0 \
>>"$tmpd/format-checks"
else
printf '%s\0' "$@" >"$files"
printf '%s\0' "$@" >"$tmpd/tidy-checks"
cp "$tmpd/tidy-checks" "$tmpd/format-checks"
fi

xargs -0 -P0 -n1 clang-format "${cf_args[@]}" <"$files"
xargs -0 -P0 -n1 clang-tidy -p build --warnings-as-errors='*' <"$files"
xargs -0 -P0 -n1 clang-format "${cf_args[@]}" <"$tmpd/format-checks"
xargs -0 -P0 -n1 clang-tidy -p build --warnings-as-errors='*' \
<"$tmpd/tidy-checks"

0 comments on commit 656d3d0

Please sign in to comment.