comparison contrib/check-code.py @ 19083:12f15e4b2ca0 stable

check-code: fix sed 'i' command rule newline matching The regular expression was meant to match cases where an 'i' command was not followed by precisely a '\' and then a newline; it failed to match the newline, so cases with a '\' but no newline would erroneously pass.
author Kevin Bullock <kbullock@ringworld.org>
date Tue, 23 Apr 2013 16:57:51 -0500
parents e97ce4a5afc5
children a91894c8064a
comparison
equal deleted inserted replaced
19082:63dda3c3bb11 19083:12f15e4b2ca0
72 (r'^alias\b.*=', "don't use alias, use a function"), 72 (r'^alias\b.*=', "don't use alias, use a function"),
73 (r'if\s*!', "don't use '!' to negate exit status"), 73 (r'if\s*!', "don't use '!' to negate exit status"),
74 (r'/dev/u?random', "don't use entropy, use /dev/zero"), 74 (r'/dev/u?random', "don't use entropy, use /dev/zero"),
75 (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"), 75 (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"),
76 (r'^( *)\t', "don't use tabs to indent"), 76 (r'^( *)\t', "don't use tabs to indent"),
77 (r'sed .*\'(\d+|/[^/]*/)i[^\\][^\n]', 77 (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)',
78 "put a backslash-escaped newline after sed 'i' command"), 78 "put a backslash-escaped newline after sed 'i' command"),
79 ], 79 ],
80 # warnings 80 # warnings
81 [ 81 [
82 (r'^function', "don't use 'function', use old style"), 82 (r'^function', "don't use 'function', use old style"),