mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 11:36:54 +00:00
Print token, not match
This commit is contained in:
parent
d422664f45
commit
480bd8b496
1 changed files with 5 additions and 4 deletions
|
|
@ -15,7 +15,8 @@ def check_for_no_commit_tokens(
|
|||
match = re.search(token, lines)
|
||||
if match:
|
||||
# no-commit token is present
|
||||
return match.string
|
||||
# return offending token
|
||||
return token
|
||||
return None
|
||||
|
||||
|
||||
|
|
@ -36,9 +37,9 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
|
|||
|
||||
for filename in args.filenames:
|
||||
_, extension = os.path.splitext(filename.lower())
|
||||
match_string = check_for_no_commit_tokens(filename, tokens)
|
||||
if match_string:
|
||||
print(f'Found no-commit token in {filename}: {match_string}')
|
||||
token = check_for_no_commit_tokens(filename, tokens)
|
||||
if token:
|
||||
print(f'Found no-commit token in {filename}: {token}')
|
||||
return_code = 1
|
||||
return return_code
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue