comparison contrib/check-code.py @ 19080:5e4491c114b2 stable

check-code: add a rule against a GNU sed-ism BSD sed requires the 'i' command to be followed with a backslash and a newline, like so: $ sed -e '/^@/i\ > other' We've encountered this problem before, e.g. in test-mq.t (900767dfa80d). This change adds a check-code rule and fixes two instances of the problem in test-record.t.
author Kevin Bullock <kbullock@ringworld.org>
date Mon, 22 Apr 2013 16:33:28 -0500
parents 341083b02d1b
children e97ce4a5afc5
comparison
equal deleted inserted replaced
19079:1e433b5457fd 19080:5e4491c114b2
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 .*\'/[^/]*/i[^\\][^\n]',
78 "put a backslash-escaped newline after sed 'i' command"),
77 ], 79 ],
78 # warnings 80 # warnings
79 [ 81 [
80 (r'^function', "don't use 'function', use old style"), 82 (r'^function', "don't use 'function', use old style"),
81 (r'^diff.*-\w*N', "don't use 'diff -N'"), 83 (r'^diff.*-\w*N', "don't use 'diff -N'"),