Skip to content

Instantly share code, notes, and snippets.

@Petelin
Created April 1, 2017 02:56
Show Gist options
  • Save Petelin/12bafd748554a92de4e9e8346d9eb3b4 to your computer and use it in GitHub Desktop.
Save Petelin/12bafd748554a92de4e9e8346d9eb3b4 to your computer and use it in GitHub Desktop.
git 提交前pep8检查
(pycharm_ascle) [~]$ cat .git-templates/hooks/pre-commit
#!/usr/bin/env bash
git diff --cached -- '*.py' | `which pep8` --max-line-length=119 --show-source --diff
if [ $? -gt 0 ]; then
echo
echo '--------'
echo 'Lint check failed.'
exit 1
fi
@Petelin
Copy link
Author

Petelin commented Apr 1, 2017

$? 是上一个命令的输出

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment