1[Hook Scripts]
2# Run mypy on all python scripts that exist in the tree. This will only generate
3# errors and warnings related to the CLs being uploaded as long as all other
4# scripts are already linter clean. However, mypy warnings will be repeated when
5# uploading multiple CLs. This is a known limitation which also affects pylint.
6# https://android.googlesource.com/platform/tools/repohooks/#todo_limitations.
7#
8# We cannot use `find ... -execdir mypy {} +` directly since find does not
9# propagate status codes from the -execXXX family of arguments so we use xargs
10# instead. We also cannot use pipes directly in a hook script so we wrap
11# everything inside a shell command (`sh -c`).
12mypy = sh -c "find . -name '*.py' | MYPYPATH=${REPO_ROOT}/external/python/markupsafe/src:${REPO_ROOT}/external/python/jinja/src:${REPO_ROOT}/prebuilts/libprotobuf/python xargs -I{} mypy --follow-imports=silent {}"
13
14[Builtin Hooks]
15clang_format = true
16commit_msg_bug_field = true
17commit_msg_changeid_field = true
18rustfmt = true
19pylint3 = true
20
21[Builtin Hooks Options]
22clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp
23rustfmt = --config-path=rustfmt.toml
24pylint3 = --disable=no-member,no-name-in-module --init-hook "import sys, os; sys.path.append('${REPO_ROOT}/prebuilts/libprotobuf/python'); sys.path.append('${REPO_ROOT}/external/python/jinja/src')" ${PREUPLOAD_FILES}
25