diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4a0fb9cbf81..b04e4c82f57 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -75,7 +75,7 @@ jobs: - name: Run flake8 run: | set -eux - pip install flake8==3.8.2 flake8-bugbear==20.1.4 flake8-comprehensions==3.3.0 flake8-executable==2.0.4 flake8-pyi==20.5.0 mccabe pycodestyle==2.6.0 pyflakes==2.2.0 + pip install -r requirements-flake8.txt flake8 --version flake8 | tee ${GITHUB_WORKSPACE}/flake8-output.txt - name: Add annotations diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6593e35e4cf..f2981c0dbb3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -891,7 +891,7 @@ which is in PyTorch's `requirements.txt`. ## Pre-commit tidy/linting hook We use clang-tidy and flake8 (installed with flake8-bugbear, -flake8-comprehensions, flake8-mypy, and flake8-pyi) to perform additional +flake8-comprehensions, flake8-pyi, and others) 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: diff --git a/requirements-flake8.txt b/requirements-flake8.txt new file mode 100644 index 00000000000..1e2ba252556 --- /dev/null +++ b/requirements-flake8.txt @@ -0,0 +1,8 @@ +flake8==3.8.2 +flake8-bugbear==20.1.4 +flake8-comprehensions==3.3.0 +flake8-executable==2.0.4 +flake8-pyi==20.5.0 +mccabe +pycodestyle==2.6.0 +pyflakes==2.2.0