Skip to content

Commit 5171bd9

Browse files
stas00facebook-github-bot
authored andcommittedDec 23, 2020
[lint doc] how to fix flake errors if pre-commit hook wasn't there (pytorch#49345)
Summary: This PR adds instructions on what to do if one committed into a PR branch w/o having a pre-commit hook enabled and having CI report flake8 errors. Pull Request resolved: pytorch#49345 Reviewed By: cpuhrsch Differential Revision: D25683167 Pulled By: soumith fbshipit-source-id: 3c45c866e1636c116d2cacec438d62c860e6b854
1 parent 55b431b commit 5171bd9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎CONTRIBUTING.md

+10
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,16 @@ You'll need to install an appropriately configured flake8; see
903903
[Lint as you type](https://github.com/pytorch/pytorch/wiki/Lint-as-you-type)
904904
for documentation on how to do this.
905905

906+
If you haven't set up the pre-commit hook and have already committed files and
907+
CI reports `flake8` errors, you can run the check locally in your PR branch with:
908+
909+
```bash
910+
flake8 $(git diff --name-only $(git merge-base --fork-point master))
911+
```
912+
913+
fix the code so that no errors are reported when you re-run the above check again,
914+
and then commit the fix.
915+
906916
## Building PyTorch with ASAN
907917
908918
[ASAN](https://github.com/google/sanitizers/wiki/AddressSanitizer) is very

0 commit comments

Comments
 (0)