mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-08 20:44:18 +00:00
Merge pull request #213 from pre-commit/report_version
Report full version in check-ast
This commit is contained in:
commit
286962eeb7
3 changed files with 8 additions and 6 deletions
|
|
@ -10,6 +10,8 @@ omit =
|
||||||
get-git-lfs.py
|
get-git-lfs.py
|
||||||
|
|
||||||
[report]
|
[report]
|
||||||
|
show_missing = True
|
||||||
|
skip_covered = True
|
||||||
exclude_lines =
|
exclude_lines =
|
||||||
# Have to re-enable the standard pragma
|
# Have to re-enable the standard pragma
|
||||||
\#\s*pragma: no cover
|
\#\s*pragma: no cover
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import ast
|
import ast
|
||||||
import os.path
|
import platform
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
|
@ -14,16 +14,16 @@ def check_ast(argv=None):
|
||||||
parser.add_argument('filenames', nargs='*')
|
parser.add_argument('filenames', nargs='*')
|
||||||
args = parser.parse_args(argv)
|
args = parser.parse_args(argv)
|
||||||
|
|
||||||
_, interpreter = os.path.split(sys.executable)
|
|
||||||
|
|
||||||
retval = 0
|
retval = 0
|
||||||
for filename in args.filenames:
|
for filename in args.filenames:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ast.parse(open(filename, 'rb').read(), filename=filename)
|
ast.parse(open(filename, 'rb').read(), filename=filename)
|
||||||
except SyntaxError:
|
except SyntaxError:
|
||||||
print('{}: failed parsing with {}:'.format(
|
print('{}: failed parsing with {} {}:'.format(
|
||||||
filename, interpreter,
|
filename,
|
||||||
|
platform.python_implementation(),
|
||||||
|
sys.version.partition(' ')[0],
|
||||||
))
|
))
|
||||||
print('\n{}'.format(
|
print('\n{}'.format(
|
||||||
' ' + traceback.format_exc().replace('\n', '\n ')
|
' ' + traceback.format_exc().replace('\n', '\n ')
|
||||||
|
|
|
||||||
2
tox.ini
2
tox.ini
|
|
@ -14,7 +14,7 @@ setenv =
|
||||||
commands =
|
commands =
|
||||||
coverage erase
|
coverage erase
|
||||||
coverage run -m pytest {posargs:tests}
|
coverage run -m pytest {posargs:tests}
|
||||||
coverage report --show-missing --fail-under 100
|
coverage report --fail-under 100
|
||||||
pre-commit install -f --install-hooks
|
pre-commit install -f --install-hooks
|
||||||
pre-commit run --all-files
|
pre-commit run --all-files
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue