I am trying to run flake8 in a pre-commit hook only on modified files in my git diff, as well as excluding files in my configuration file.
files=$(git diff --cached --name-only --diff-filter=ACM);
if flake8 --config=/path/to/config/flake8-hook.ini $files; then
exit 1;
fi
I really want to do:
flake8 --exclude=/foo/ /foo/stuff.py
And then with flake8, skip the file that I transferred, because it is in the exclude variable.
I also want it to exclude files that are not .py files. For instance:
flake8 example.js
Now when I test, none of them work. Does anyone have any ideas?
source
share