File: check_clang_format.sh

package info (click to toggle)
openmw 0.49.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,992 kB
  • sloc: cpp: 372,479; xml: 2,149; sh: 1,403; python: 797; makefile: 26
file content (8 lines) | stat: -rwxr-xr-x 399 bytes parent folder | download
1
2
3
4
5
6
7
8
#!/bin/bash -ex

set -o pipefail

CLANG_FORMAT="${CLANG_FORMAT:-clang-format}"
git ls-files -- ':(exclude)extern/' '*.cpp' '*.hpp' '*.h' |
    xargs -I '{}' -P $(nproc) bash -ec "\"${CLANG_FORMAT:?}\" --dry-run -Werror \"\${0:?}\" &> /dev/null || \"${CLANG_FORMAT:?}\" \"\${0:?}\" | git diff --color=always --no-index \"\${0:?}\" -" '{}' ||
    ( echo "clang-format differences detected"; exit -1 )