Skip to content

Commit b3f3c34

Browse files
authored
Merge pull request #476 from pre-commit/remove_flake8
remove flake8 and suggest pycqa/flake8
2 parents acd6b16 + b9cc9d7 commit b3f3c34

File tree

6 files changed

+41
-28
lines changed

6 files changed

+41
-28
lines changed

.pre-commit-hooks.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
- id: autopep8-wrapper
22
name: autopep8 wrapper
33
description: This is deprecated, use pre-commit/mirrors-autopep8 instead.
4-
entry: autopep8-wrapper
4+
entry: pre-commit-hooks-removed autopep8-wrapper autopep8 https://github.com/pre-commit/mirrors-autopep8
55
language: python
6-
types: [python]
7-
args: [-i]
6+
always_run: true
7+
pass_filenames: false
88
- id: check-added-large-files
99
name: Check for added large files
1010
description: Prevent giant files from being committed
@@ -140,10 +140,10 @@
140140
- id: flake8
141141
name: Flake8 (deprecated, use gitlab.com/pycqa/flake8)
142142
description: This hook runs flake8. (deprecated, use gitlab.com/pycqa/flake8)
143-
entry: flake8
143+
entry: pre-commit-hooks-removed flake8 flake8 https://gitlab.com/pycqa/flake8
144144
language: python
145-
types: [python]
146-
require_serial: true
145+
always_run: true
146+
pass_filenames: false
147147
- id: forbid-new-submodules
148148
name: Forbid new submodules
149149
language: python
@@ -170,9 +170,10 @@
170170
- id: pyflakes
171171
name: Pyflakes (DEPRECATED, use flake8)
172172
description: This hook runs pyflakes. (This is deprecated, use flake8).
173-
entry: pyflakes
173+
entry: pre-commit-hooks-removed pyflakes flake8 https://gitlab.com/pycqa/flake8
174174
language: python
175-
types: [python]
175+
always_run: true
176+
pass_filenames: false
176177
- id: requirements-txt-fixer
177178
name: Fix requirements.txt
178179
description: Sorts entries in requirements.txt

pre_commit_hooks/autopep8_wrapper.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

pre_commit_hooks/removed.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import sys
2+
from typing import Optional
3+
from typing import Sequence
4+
5+
6+
def main(argv: Optional[Sequence[str]] = None) -> int:
7+
argv = argv if argv is not None else sys.argv[1:]
8+
hookid, new_hookid, url = argv
9+
raise SystemExit(
10+
f'`{hookid}` has been removed -- use `{new_hookid}` from {url}',
11+
)
12+
13+
14+
if __name__ == '__main__':
15+
exit(main())

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ python_requires = >=3.6.1
2929

3030
[options.entry_points]
3131
console_scripts =
32-
autopep8-wrapper = pre_commit_hooks.autopep8_wrapper:main
3332
check-added-large-files = pre_commit_hooks.check_added_large_files:main
3433
check-ast = pre_commit_hooks.check_ast:main
3534
check-builtin-literals = pre_commit_hooks.check_builtin_literals:main
@@ -55,6 +54,7 @@ console_scripts =
5554
mixed-line-ending = pre_commit_hooks.mixed_line_ending:main
5655
name-tests-test = pre_commit_hooks.tests_should_end_in_test:main
5756
no-commit-to-branch = pre_commit_hooks.no_commit_to_branch:main
57+
pre-commit-hooks-removed = pre_commit_hooks.removed:main
5858
pretty-format-json = pre_commit_hooks.pretty_format_json:main
5959
requirements-txt-fixer = pre_commit_hooks.requirements_txt_fixer:main
6060
sort-simple-yaml = pre_commit_hooks.sort_simple_yaml:main

tests/autopep8_wrapper_test.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/removed_test.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import pytest
2+
3+
from pre_commit_hooks.removed import main
4+
5+
6+
def test_always_fails():
7+
with pytest.raises(SystemExit) as excinfo:
8+
main((
9+
'autopep8-wrapper', 'autopep8',
10+
'https://github.com/pre-commit/mirrors-autopep8',
11+
))
12+
msg, = excinfo.value.args
13+
assert msg == (
14+
'`autopep8-wrapper` has been removed -- '
15+
'use `autopep8` from https://github.com/pre-commit/mirrors-autopep8'
16+
)

0 commit comments

Comments
 (0)