mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-13 07:41:19 +08:00
Merge pull request #293 from pre-commit/dont_match_whitespace_regex
Improve vcs regex (don't match whitespace)
This commit is contained in:
@@ -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,))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user