mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
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.
This commit is contained in:
parent
9bdc85760e
commit
61c827dff1
@ -29,7 +29,7 @@ errors = [
|
|||||||
(r"^# .*\n.*\.\s+$", "don't add trailing period on summary line"),
|
(r"^# .*\n.*\.\s+$", "don't add trailing period on summary line"),
|
||||||
(r"^# .*\n.{78,}", "summary line too long (limit is 78)"),
|
(r"^# .*\n.{78,}", "summary line too long (limit is 78)"),
|
||||||
(r"^\+\n \n", "adds double empty line"),
|
(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")
|
node = os.environ.get("HG_NODE")
|
||||||
|
Loading…
Reference in New Issue
Block a user