File: format-all

package info (click to toggle)
pbcopper 2.3.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 10,956 kB
  • sloc: ansic: 164,688; cpp: 53,414; sh: 184; makefile: 22
file content (17 lines) | stat: -rwxr-xr-x 658 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash

# This command can be run by the user to clang-format everything.

PLATFORM=$(uname)
TOOLSPATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
CLANGFORMAT="${TOOLSPATH}/${PLATFORM}/clang-format -style=file"

pushd "$TOOLSPATH/.." > /dev/null
CHECK_DIRS=()
for DIR in "include" "src" "tests/src" "tests/unit" "tools"; do [ -d "$TOOLSPATH/../$DIR" ] && CHECK_DIRS+=("$DIR") ; done
find ${CHECK_DIRS[@]} \
    \( -name '*.cpp' -o -name '*.h' -o -name '*.cu' -o -name '*.cuh' -o -name '*.hpp' \) \
    -not -name pugi* -not -name json.hpp -not -path '*/third-party/*' \
    -print0 \
    | xargs -n1 -0 ${CLANGFORMAT} -i
popd > /dev/null