mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-30 02:16:52 +00:00
Merge pull request #293 from pre-commit/dont_match_whitespace_regex
Improve vcs regex (don't match whitespace)
This commit is contained in:
commit
fa7a3b5466
2 changed files with 4 additions and 2 deletions
|
|
@ -8,7 +8,7 @@ import sys
|
|||
|
||||
|
||||
GITHUB_NON_PERMALINK = re.compile(
|
||||
b'https://github.com/[^/]+/[^/]+/blob/master/[^# ]+#L\d+',
|
||||
b'https://github.com/[^/ ]+/[^/ ]+/blob/master/[^# ]+#L\d+',
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ def test_passing(tmpdir):
|
|||
# permalinks are ok
|
||||
b'https://github.com/asottile/test/blob/649e6/foo%20bar#L1\n'
|
||||
# links to files but not line numbers are ok
|
||||
b'https://github.com/asottile/test/blob/master/foo%20bar\n',
|
||||
b'https://github.com/asottile/test/blob/master/foo%20bar\n'
|
||||
# regression test for overly-greedy regex
|
||||
b'https://github.com/ yes / no ? /blob/master/foo#L1\n',
|
||||
)
|
||||
assert not main((f.strpath,))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue