remove flake8 and suggest pycqa/flake8

This commit is contained in:
Anthony Sottile 2020-05-14 16:00:29 -07:00
parent acd6b162ce
commit b9cc9d7761
6 changed files with 41 additions and 28 deletions

View File

@ -1,10 +1,10 @@
- id: autopep8-wrapper
name: autopep8 wrapper
description: This is deprecated, use pre-commit/mirrors-autopep8 instead.
entry: autopep8-wrapper
entry: pre-commit-hooks-removed autopep8-wrapper autopep8 https://github.com/pre-commit/mirrors-autopep8
language: python
types: [python]
args: [-i]
always_run: true
pass_filenames: false
- id: check-added-large-files
name: Check for added large files
description: Prevent giant files from being committed
@ -140,10 +140,10 @@
- id: flake8
name: Flake8 (deprecated, use gitlab.com/pycqa/flake8)
description: This hook runs flake8. (deprecated, use gitlab.com/pycqa/flake8)
entry: flake8
entry: pre-commit-hooks-removed flake8 flake8 https://gitlab.com/pycqa/flake8
language: python
types: [python]
require_serial: true
always_run: true
pass_filenames: false
- id: forbid-new-submodules
name: Forbid new submodules
language: python
@ -170,9 +170,10 @@
- id: pyflakes
name: Pyflakes (DEPRECATED, use flake8)
description: This hook runs pyflakes. (This is deprecated, use flake8).
entry: pyflakes
entry: pre-commit-hooks-removed pyflakes flake8 https://gitlab.com/pycqa/flake8
language: python
types: [python]
always_run: true
pass_filenames: false
- id: requirements-txt-fixer
name: Fix requirements.txt
description: Sorts entries in requirements.txt

View File

@ -1,9 +0,0 @@
def main() -> int:
raise SystemExit(
'autopep8-wrapper is deprecated. Instead use autopep8 directly via '
'https://github.com/pre-commit/mirrors-autopep8',
)
if __name__ == '__main__':
exit(main())

View File

@ -0,0 +1,15 @@
import sys
from typing import Optional
from typing import Sequence
def main(argv: Optional[Sequence[str]] = None) -> int:
argv = argv if argv is not None else sys.argv[1:]
hookid, new_hookid, url = argv
raise SystemExit(
f'`{hookid}` has been removed -- use `{new_hookid}` from {url}',
)
if __name__ == '__main__':
exit(main())

View File

@ -29,7 +29,6 @@ python_requires = >=3.6.1
[options.entry_points]
console_scripts =
autopep8-wrapper = pre_commit_hooks.autopep8_wrapper:main
check-added-large-files = pre_commit_hooks.check_added_large_files:main
check-ast = pre_commit_hooks.check_ast:main
check-builtin-literals = pre_commit_hooks.check_builtin_literals:main
@ -55,6 +54,7 @@ console_scripts =
mixed-line-ending = pre_commit_hooks.mixed_line_ending:main
name-tests-test = pre_commit_hooks.tests_should_end_in_test:main
no-commit-to-branch = pre_commit_hooks.no_commit_to_branch:main
pre-commit-hooks-removed = pre_commit_hooks.removed:main
pretty-format-json = pre_commit_hooks.pretty_format_json:main
requirements-txt-fixer = pre_commit_hooks.requirements_txt_fixer:main
sort-simple-yaml = pre_commit_hooks.sort_simple_yaml:main

View File

@ -1,10 +0,0 @@
import pytest
from pre_commit_hooks.autopep8_wrapper import main
def test_invariantly_fails():
with pytest.raises(SystemExit) as excinfo:
main()
msg, = excinfo.value.args
assert 'https://github.com/pre-commit/mirrors-autopep8' in msg

16
tests/removed_test.py Normal file
View File

@ -0,0 +1,16 @@
import pytest
from pre_commit_hooks.removed import main
def test_always_fails():
with pytest.raises(SystemExit) as excinfo:
main((
'autopep8-wrapper', 'autopep8',
'https://github.com/pre-commit/mirrors-autopep8',
))
msg, = excinfo.value.args
assert msg == (
'`autopep8-wrapper` has been removed -- '
'use `autopep8` from https://github.com/pre-commit/mirrors-autopep8'
)