diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index be99f71..f7b674c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,28 +1,4 @@ -- repo: https://github.com/pre-commit/pre-commit-hooks - sha: v0.8.0 +- repo: https://github.com/tom-aa/pre-commit-hooks + sha: demo hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: autopep8-wrapper - - id: check-docstring-first - - id: check-json - - id: check-added-large-files - - id: check-yaml - - id: debug-statements - - id: name-tests-test - - id: requirements-txt-fixer - - id: flake8 -- repo: https://github.com/pre-commit/pre-commit - sha: v0.12.2 - hooks: - - id: validate_config - - id: validate_manifest -- repo: https://github.com/asottile/reorder_python_imports - sha: v0.3.1 - hooks: - - id: reorder-python-imports - language_version: python2.7 -- repo: https://github.com/asottile/pyupgrade - sha: v1.0.0 - hooks: - - id: pyupgrade + - id: pep8-check diff --git a/hooks.yaml b/hooks.yaml index bda3f76..e9205cd 100644 --- a/hooks.yaml +++ b/hooks.yaml @@ -1,7 +1,14 @@ +- id: pep8-check + name: pep8 check + description: "demo" + entry: pep8-check + language: python + files: \.py$ + args: [-i] - id: autopep8-wrapper name: autopep8 wrapper description: "Runs autopep8 over python source. If you configure additional arguments you'll want to at least include -i." - entry: autopep8-wrapper + entry: autopep8-wrapper language: python files: \.py$ args: [-i] diff --git a/pre_commit_hooks/pep8_check.py b/pre_commit_hooks/pep8_check.py new file mode 100644 index 0000000..1422b42 --- /dev/null +++ b/pre_commit_hooks/pep8_check.py @@ -0,0 +1,24 @@ +from __future__ import absolute_import +from __future__ import print_function +from __future__ import unicode_literals + +import argparse +import io +import sys +import xml.sax +from pre_commit_hooks.util import cmd_output + + +def check_pep8(argv=None): + parser = argparse.ArgumentParser() + parser.add_argument('filenames', nargs='*', help='XML filenames to check.') + args = parser.parse_args(argv) + print (args) + + retval = 0 + lines = cmd_output("git diff --cached -- '*.py' | " + "`which pep8` --max-line-length=119 --show-source --diff --ignore=E402,E731").splitlines() + if len(lines) > 0: + print (lines) + retval = 1 + return retval diff --git a/setup.py b/setup.py index 4abb7a2..15a139f 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,17 @@ -from setuptools import find_packages +fom setuptools import find_packages from setuptools import setup +i + + + +#123123 setup( + + + + name='pre_commit_hooks', description='Some out-of-the-box hooks for pre-commit.', url='https://github.com/pre-commit/pre-commit-hooks', @@ -33,6 +42,7 @@ setup( ], entry_points={ 'console_scripts': [ + 'pep8-check = pre_commit_hooks.pep8_check:main', '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:check_ast',