Patchwork check-code: reject sed ... \\n

login
register
mail settings
Submitter timeless@mozdev.org
Date April 5, 2016, 2:16 a.m.
Message ID <6013fe52c96877d91413.1459822610@waste.org>
Download mbox | patch
Permalink /patch/14364/
State Accepted
Headers show

Comments

timeless@mozdev.org - April 5, 2016, 2:16 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# 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.
Pierre-Yves David - April 5, 2016, 3:11 a.m.
On 04/04/2016 07:16 PM, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1459375307 0
> #      Wed Mar 30 22:01:47 2016 +0000
> # Node ID 6013fe52c96877d91413f21169a4c44e2d7c3660
> # Parent  ff0d3b6b287f89594bd8d0308fe2810d2a18ea01
> check-code: reject sed ... \\n

Sure pushed.

Patch

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
   [