mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-15 21:00:47 +00:00
Summary: This PR adds clang-format automation: - It only checks on whitelisted files, so we can enable incrementally without noise - There is a pre-commit hook provided that will do the same check, plus prompt users to apply the clang-format changes (no change is made without the user agreeing). My plan is to migrate over whole files at a time, clang-formatting them and then adding them to the whitelist. Doing it this way should avoid too many merge pains (the most you'll have to is run clang-format on the affected file before rebasing). Pull Request resolved: https://github.com/pytorch/pytorch/pull/15254 Differential Revision: D13515888 Pulled By: suo fbshipit-source-id: d098eabcc97aa228c4dfce8fc096c3b5a45b591f
14 lines
371 B
Bash
Executable file
14 lines
371 B
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
echo "Running pre-commit flake8"
|
|
python tools/flake8_hook.py
|
|
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
|
|
echo "Running pre-commit clang-format"
|
|
python tools/clang_format.py
|