mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
Summary: The precommit hook shouldn't hard fail if there's no `clang-tidy`, just warn and omit the check. Pull Request resolved: https://github.com/pytorch/pytorch/pull/15514 Differential Revision: D13545776 Pulled By: suo fbshipit-source-id: 9bf3f8ee18703c6d1a39eb7776092fb5e120d2a1
22 lines
550 B
Bash
Executable file
22 lines
550 B
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
echo "Running pre-commit flake8"
|
|
python tools/flake8_hook.py
|
|
|
|
if [ $(which clang-tidy) ]
|
|
then
|
|
echo "Running pre-commit clang-tidy"
|
|
python tools/clang_tidy.py \
|
|
--paths torch/csrc \
|
|
--diff HEAD \
|
|
-g"-torch/csrc/distributed/Module.cpp" \
|
|
-g"-torch/csrc/jit/export.cpp" \
|
|
-g"-torch/csrc/jit/import.cpp" \
|
|
-j
|
|
else
|
|
echo "WARNING: Couldn't find clang-tidy executable."
|
|
echo " Please install it if you want local clang-tidy checks."
|
|
fi
|
|
|
|
echo "Running pre-commit clang-format"
|
|
python tools/clang_format.py
|