adjust error outputs to be more standardized
diff --git a/pre_commit_hooks/check_docstring_first.py b/pre_commit_hooks/check_docstring_first.py
index 1744919..d55f08a 100644
--- a/pre_commit_hooks/check_docstring_first.py
+++ b/pre_commit_hooks/check_docstring_first.py
@@ -28,13 +28,13 @@
if tok_type == tokenize.STRING and scol == 0:
if found_docstring_line is not None:
print(
- f'{filename}:{sline} Multiple module docstrings '
+ f'{filename}:{sline}: Multiple module docstrings '
f'(first docstring on line {found_docstring_line}).',
)
return 1
elif found_code_line is not None:
print(
- f'{filename}:{sline} Module docstring appears after code '
+ f'{filename}:{sline}: Module docstring appears after code '
f'(code seen on line {found_code_line}).',
)
return 1
diff --git a/pre_commit_hooks/check_merge_conflict.py b/pre_commit_hooks/check_merge_conflict.py
index 22031a2..15ec284 100644
--- a/pre_commit_hooks/check_merge_conflict.py
+++ b/pre_commit_hooks/check_merge_conflict.py
@@ -10,6 +10,7 @@
CONFLICT_PATTERNS = [
b'<<<<<<< ',
b'======= ',
+ b'=======\r\n',
b'=======\n',
b'>>>>>>> ',
]
@@ -39,12 +40,12 @@
retcode = 0
for filename in args.filenames:
with open(filename, 'rb') as inputfile:
- for i, line in enumerate(inputfile):
+ for i, line in enumerate(inputfile, start=1):
for pattern in CONFLICT_PATTERNS:
if line.startswith(pattern):
print(
- f'Merge conflict string "{pattern.decode()}" '
- f'found in {filename}:{i + 1}',
+ f'{filename}:{i}: Merge conflict string '
+ f'{pattern.strip().decode()!r} found',
)
retcode = 1
diff --git a/pre_commit_hooks/debug_statement_hook.py b/pre_commit_hooks/debug_statement_hook.py
index 00b6798..9ada657 100644
--- a/pre_commit_hooks/debug_statement_hook.py
+++ b/pre_commit_hooks/debug_statement_hook.py
@@ -65,7 +65,7 @@
visitor.visit(ast_obj)
for bp in visitor.breakpoints:
- print(f'{filename}:{bp.line}:{bp.col} - {bp.name} {bp.reason}')
+ print(f'{filename}:{bp.line}:{bp.col}: {bp.name} {bp.reason}')
return int(bool(visitor.breakpoints))