-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add flake8 pre-commit * Create CONTRIBUTING.md
- Loading branch information
1 parent
2ade822
commit f32a40e
Showing
4 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Contributing guidelines | ||
|
||
## Pre-commit tidy/linting hook | ||
|
||
You'll need to install flake8 first. | ||
|
||
We use flake8 to perform additional formatting and semantic checking of code. | ||
We provide a pre-commit git hook for performing these checks, before a commit | ||
is created: | ||
|
||
```bash | ||
ln -s ../../tools/git-pre-commit .git/hooks/pre-commit | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
flake8 | ||
pyyaml | ||
typeguard | ||
tensorboardX | ||
typeguard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import sys | ||
|
||
from flake8.main import git | ||
|
||
if __name__ == '__main__': | ||
sys.exit( | ||
git.hook( | ||
strict=True, | ||
lazy=git.config_for('lazy'), | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo "Running pre-commit flake8" | ||
python tools/flake8_hook.py |