From patchwork Tue Apr 5 02:16:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: check-code: reject sed ... \\n From: timeless@mozdev.org X-Patchwork-Id: 14364 Message-Id: <6013fe52c96877d91413.1459822610@waste.org> To: mercurial-devel@mercurial-scm.org Date: Mon, 04 Apr 2016 21:16:50 -0500 # HG changeset patch # User timeless # Date 1459375307 0 # Wed Mar 30 22:01:47 2016 +0000 # Node ID 6013fe52c96877d91413f21169a4c44e2d7c3660 # Parent ff0d3b6b287f89594bd8d0308fe2810d2a18ea01 check-code: reject sed ... \\n This would have caught 142891ab6e89 (fixed by a5a13eeffc59) if repcomment didn't make the content of the perl code opaque to the check. diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -132,6 +132,7 @@ (r'\butil\.Abort\b', "directly use error.Abort"), (r'\|&', "don't use |&, use 2>&1"), (r'\w = +\w', "only one space after = allowed"), + (r'\bsed\b.*[^\\]\\n', "don't use 'sed ... \\n', use a \\ and a newline"), ], # warnings [