summaryrefslogtreecommitdiff
path: root/evergreen/run_clang_tidy.sh
blob: 07f3ec4067cb7933a0d8eaba3f8634170904d787 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
set -o errexit
set -o verbose

cd src
# TODO SERVER-49884 Remove this when we no longer check in generated Bison.
# Here we use the -header-filter option to instruct clang-tidy to scan our header files. The
# regex instructs clang-tidy to scan headers in our source directory with the mongo/* regex, and
# the build directory to analyze generated headers with the build/* regex
BISON_GENERATED_PATTERN=parser_gen\.cpp
jq -r '.[] | .file' compile_commands.json \
  | grep src/mongo \
  | grep -v $BISON_GENERATED_PATTERN \
  | xargs -n 32 -P $(grep -c ^processor /proc/cpuinfo) -t \
    /opt/mongodbtoolchain/v3/bin/clang-tidy \
    -p ./compile_commands.json \
    -header-filter='(mongo/.*|build/.*)' \
    --checks="-*,bugprone-unused-raii,bugprone-use-after-move,readability-const-return-type,readability-avoid-const-params-in-decls" \
    -warnings-as-errors="*"