Put Flake8 requirements into their own file (#49032)

Summary:
This PR moves the list of Flake8 requirements/versions out of `.github/workflows/lint.yml` and into its own file `requirements-flake8.txt`. After (if) this PR is merged, I'll modify the Flake8 installation instructions on [the "Lint as you type" wiki page](https://github.com/pytorch/pytorch/wiki/Lint-as-you-type) (and its internal counterpart) to just say to install from that new file, rather than linking to the GitHub Actions YAML file and/or giving a command with a set of packages to install that keeps becoming out-of-date.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/49032

Test Plan:
Either look at CI, or run locally using [act](https://github.com/nektos/act):
```sh
act -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 -j flake8-py3
```

Reviewed By: janeyx99

Differential Revision: D25404037

Pulled By: samestep

fbshipit-source-id: ba4d1e17172a7808435df06cba8298b2b91bb27c
This commit is contained in:
Sam Estep
2020-12-08 13:23:51 -08:00
committed by Facebook GitHub Bot
parent 2b70bcd014
commit d1fb4b4ffc
3 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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:

8
requirements-flake8.txt Normal file
View File

@ -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