我想在我的git diff中更改后的文件的pre-hook中运行flake8,同时也排除了我的配置文件中的文件。flake8,只在差异和排除
files=$(git diff --cached --name-only --diff-filter=ACM);
if flake8 --config=/path/to/config/flake8-hook.ini $files; then
exit 1;
fi
我基本上是想这样做:
flake8 --exclude=/foo/ /foo/stuff.py
再有flake8跳过我通过,因为它是在排除变量的文件。
我也希望它排除不是.py文件的文件。例如:
flake8 example.js
就在我测试的时候,它们都不起作用。有人有主意吗?
flake8基本上可以为您做所有事情:http://flake8.pycqa.org/zh/latest/user/using-hooks.html – 2017-03-24 18:03:45