mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 11:36:54 +00:00
Merge 38bd34f828 into 1bdd699a79
This commit is contained in:
commit
3e037681b8
2 changed files with 15 additions and 1 deletions
|
|
@ -42,6 +42,12 @@ def check_file_for_debug_statements(filename):
|
|||
print('\t' + traceback.format_exc().replace('\n', '\n\t'))
|
||||
print()
|
||||
return 1
|
||||
except Exception:
|
||||
print('{} - Caught exception while reading file'.format(filename))
|
||||
print()
|
||||
print('\t' + traceback.format_exc().replace('\n', '\n\t'))
|
||||
print()
|
||||
return 1
|
||||
visitor = ImportStatementParser()
|
||||
visitor.visit(ast_obj)
|
||||
if visitor.debug_import_statements:
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ from __future__ import unicode_literals
|
|||
import argparse
|
||||
import io
|
||||
import tokenize
|
||||
import traceback
|
||||
|
||||
|
||||
double_quote_starts = tuple(s for s in tokenize.single_quoted if '"' in s)
|
||||
|
|
@ -32,7 +33,14 @@ def get_line_offsets_by_line_no(src):
|
|||
|
||||
|
||||
def fix_strings(filename):
|
||||
contents = io.open(filename).read()
|
||||
try:
|
||||
contents = io.open(filename).read()
|
||||
except Exception:
|
||||
print('{} - Caught exception while reading file'.format(filename))
|
||||
print()
|
||||
print('\t' + traceback.format_exc().replace('\n', '\n\t'))
|
||||
print()
|
||||
return 1
|
||||
line_offsets = get_line_offsets_by_line_no(contents)
|
||||
|
||||
# Basically a mutable string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue