From dcbc4f32dbd42456af6965b8458050878d8f62a2 Mon Sep 17 00:00:00 2001 From: Michael Suo Date: Thu, 3 Jan 2019 13:50:42 -0800 Subject: [PATCH] flake8 hook fix (#15693) Summary: This PR bypasses checking the user's configuration entirely and always use strict, since the CI considers it a hard failure if you can't pass flake8. Pull Request resolved: https://github.com/pytorch/pytorch/pull/15693 Differential Revision: D13574889 Pulled By: suo fbshipit-source-id: f5e1c5731cc49b6223b415317033c275bc7d4fec --- tools/flake8_hook.py | 2 +- tools/git-pre-commit | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/tools/flake8_hook.py b/tools/flake8_hook.py index 8648a2f57666..c4b5691195ca 100755 --- a/tools/flake8_hook.py +++ b/tools/flake8_hook.py @@ -5,7 +5,7 @@ from flake8.main import git if __name__ == '__main__': sys.exit( git.hook( - strict=git.config_for('strict'), + strict=True, lazy=git.config_for('lazy'), ) ) diff --git a/tools/git-pre-commit b/tools/git-pre-commit index a832b04b7062..1067f40cccdd 100755 --- a/tools/git-pre-commit +++ b/tools/git-pre-commit @@ -1,11 +1,8 @@ #!/bin/bash +set -e + echo "Running pre-commit flake8" -FLAKE8_OUT=$(python tools/flake8_hook.py) -if [[ ${FLAKE8_OUT} ]] -then - echo "${FLAKE8_OUT}" - exit 1 -fi +python tools/flake8_hook.py if [ $(which clang-tidy) ] then