Mercurial > hg
changeset 25379:894bcdbb9e7a
check-commit: make foo_bar naming regexp less greedy
\s is equivalent to the character class [ \t\n\r\f\v]. Using \s+ in
a regular expression against input with multiple lines may match across
multiple lines.
For the regexp in question, "\+\s+" would match "+\n " and similar
sequences, leading to false positives for functions that were included
in diff context, after a modified hunk.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 31 May 2015 17:41:35 -0700 |
parents | 98b5676323db |
children | eaa456c5e699 |
files | contrib/check-commit |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/check-commit Wed May 27 12:05:08 2015 -0700 +++ b/contrib/check-commit Sun May 31 17:41:35 2015 -0700 @@ -29,7 +29,7 @@ (r"^# .*\n.*\.\s+$", "don't add trailing period on summary line"), (r"^# .*\n.{78,}", "summary line too long (limit is 78)"), (r"^\+\n \n", "adds double empty line"), - (r"\+\s+def [a-z]+_[a-z]", "adds a function with foo_bar naming"), + (r"^\+[ \t]+def [a-z]+_[a-z]", "adds a function with foo_bar naming"), ] node = os.environ.get("HG_NODE")