pytorch/tools/git-pre-commit
Elton Leander Pinto 91bc285084 Fix clang-tidy error in pre-commit script (#61918)
Summary:
Fixes a clang-tidy error in the git-pre-commit script. See log below for the error it fixes.

```
Running pre-commit flake8
Running pre-commit clang-tidy
usage: clang_tidy [-h] [-e CLANG_TIDY_EXE] [-g GLOB] [-x REGEX] [-c COMPILE_COMMANDS_DIR] [--diff-file DIFF_FILE] [-p PATHS [PATHS ...]] [-n] [-v] [-q] [--config-file CONFIG_FILE] [--print-include-paths] [-I INCLUDE_DIR] [-s]
                  [--disable-progress-bar]
                  [extra_args [extra_args ...]]
clang_tidy: error: unrecognized arguments: -j
```

It gets rid of the redundant binary check because `tools.linter.clang_tidy` already does this.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/61918

Test Plan: Run `tools/git-pre-commit`. It should not show a clang-tidy error.

Reviewed By: driazati

Differential Revision: D29796383

Pulled By: 1ntEgr8

fbshipit-source-id: b804b0170747f04e84d21e03d1c4985748d78cf2
2021-07-20 12:40:56 -07:00

14 lines
303 B
Bash
Executable File

#!/bin/bash
set -e
echo "Running pre-commit flake8"
python3 tools/linter/flake8_hook.py
echo "Running pre-commit clang-tidy"
git diff HEAD > pr.diff
python3 -m tools.linter.clang_tidy --diff-file "pr.diff"
rm pr.diff
echo "Running pre-commit clang-format"
tools/linter/git-clang-format HEAD~ --force