From 199132122bbbfda1483ba3e012f6548eb2ba654a Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Mon, 13 Jun 2022 21:30:09 -0400 Subject: [PATCH] Add pre-commit config for flake8 (#8068) This makes it easier to lint your own work with `pre-commit`, but doesn't change the CI config by adding this to the pre-commit.ci skip list. There's no way to automatically reflect the additional dependencies from the requirements file, so the flake8 plugin list needs to be a verbatim copy. resolves #7991 --- .pre-commit-config.yaml | 10 +++++++++- requirements-tests.txt | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ccc7cffa4..f64cee051 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,11 +9,19 @@ repos: hooks: - id: isort name: isort (python) + - repo: https://github.com/pycqa/flake8 + rev: 4.0.1 # must match requirements-tests.txt + hooks: + - id: flake8 + additional_dependencies: + # must match requirements-tests.txt + - 'flake8-bugbear==21.11.29' + - 'flake8-pyi==22.5.1' ci: autofix_commit_msg: '[pre-commit.ci] auto fixes from pre-commit.com hooks' autofix_prs: true autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' autoupdate_schedule: weekly - skip: [] + skip: [flake8] submodules: false diff --git a/requirements-tests.txt b/requirements-tests.txt index 7c3dfe1d8..1a967323c 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -2,6 +2,7 @@ mypy==0.960 pytype==2022.6.6; platform_system != "Windows" # must match .pre-commit-config.yaml black==22.3.0 +# must match .pre-commit-config.yaml flake8==4.0.1 flake8-bugbear==21.11.29 flake8-pyi==22.5.1