Skip to content

Commit

Permalink
⇪🧪 Bump flake8 to v7
Browse files Browse the repository at this point in the history
This also includes bumping WPS, merging two separate flake8
invocations onto one, dropping the old version enforcement
and removing plugin variants for deprecated Pythons.
  • Loading branch information
webknjaz committed Apr 24, 2024
1 parent d787d31 commit 6f1e5b5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 54 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ extend-exclude =
# Completely and unconditionally ignore the following errors:
extend-ignore =
# Legitimate cases, no need to "fix" these violations:
# C81X: reported by deprecated `flake8-commas`, covered by add-trailing-comma
C81,
# E501: "line too long", its function is replaced by `flake8-length`
E501,
# W505: "doc line too long", its function is replaced by `flake8-length`
Expand Down
57 changes: 4 additions & 53 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,36 +144,19 @@ repos:
- --strict

- repo: https://github.com/PyCQA/flake8.git
rev: 6.0.0
rev: 7.0.0
hooks:
- id: flake8
alias: flake8-no-wps
name: flake8 WPS-excluded
additional_dependencies:
- darglint ~= 1.8.1
- flake8-2020 ~= 1.7.0
- flake8-annotations ~= 2.9.1; python_version >= "3.7"
- flake8-annotations ~= 2.7.0; python_version < "3.7"
- flake8-annotations ~= 2.9.1
- flake8-docstrings ~= 1.6.0
- flake8-length ~= 0.3.0
- flake8-logging-format ~= 0.7.5
- flake8-pytest-style ~= 1.6.0
- flake8-spellcheck ~= 0.28.0; python_version >= "3.8"
- flake8-spellcheck ~= 0.26.0; python_version < "3.8"
language_version: python3

- repo: https://github.com/PyCQA/flake8.git
# NOTE: This is kept at v4 for until WPS starts supporting flake v5.
rev: 4.0.1 # enforce-version: 4.0.1
hooks:
- id: flake8
alias: flake8-only-wps
name: flake8 WPS-only
args:
- --select
- WPS
additional_dependencies:
- wemake-python-styleguide ~= 0.17.0
- flake8-spellcheck ~= 0.28.0
- wemake-python-styleguide ~= 0.19.0
language_version: python3

- repo: https://github.com/Lucas-C/pre-commit-hooks-lxml.git
Expand Down Expand Up @@ -276,36 +259,4 @@ repos:
- Sphinx
- trustme # needed by pylint-pytest since it picks up pytest's args

- repo: local
hooks:
- id: enforced-flake8-version
name: Verify that enforced flake8 version stays unchanged
description: >-
This is a sanity check and fixer that makes sure that
the `flake8` version in this file remains matching the
corresponding request in the `# enforce-version` comment.
# Using Python here because using
# shell test does not always work in CIs:
entry: >-
python -c 'import pathlib, re, sys;
pre_commit_config = pathlib.Path(sys.argv[1]);
cfg_txt = pre_commit_config.read_text();
new_cfg_txt = re.sub(
r"(?P<spaces>\s+)rev:\s(?:\d+\.\d+\.\d+)\s{0,2}"
r"#\senforce-version:\s(?P<enforced_version>\d+\.\d+\.\d+)"
r"[ \t\f\v]*",
r"\g<spaces>rev: \g<enforced_version> "
r"# enforce-version: \g<enforced_version>",
cfg_txt,
);
cfg_txt != new_cfg_txt and
pre_commit_config.write_text(new_cfg_txt)
'
pass_filenames: true
language: system
files: >-
^\.pre-commit-config\.ya?ml$
types:
- yaml

...
1 change: 1 addition & 0 deletions cheroot/test/webtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def interactive(self):
'Interactive test failure interceptor support via '
'WEBTEST_INTERACTIVE environment variable is deprecated.',
DeprecationWarning,
stacklevel=1,
)
return is_interactive

Expand Down
2 changes: 1 addition & 1 deletion cheroot/workers/threadpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _process_connections_until_interrupted(self):
raise SystemExit(
str(shutdown_request),
) from shutdown_request
except BaseException as unhandled_error: # noqa: WPS424
except BaseException as unhandled_error: # noqa: B036, WPS424
# NOTE: Only a shutdown request should bubble up to the
# NOTE: external cleanup code. Otherwise, this thread dies.
# NOTE: If this were to happen, the threadpool would still
Expand Down

0 comments on commit 6f1e5b5

Please sign in to comment.