##// END OF EJS Templates
tests: run most check-code sh checks on continued lines too...
Mads Kiilerich -
r16672:d046eb97 default
parent child Browse files
Show More
@@ -45,12 +45,10 b' testpats = ['
45 [
45 [
46 (r'pushd|popd', "don't use 'pushd' or 'popd', use 'cd'"),
46 (r'pushd|popd', "don't use 'pushd' or 'popd', use 'cd'"),
47 (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"),
47 (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"),
48 (r'^function', "don't use 'function', use old style"),
49 (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
48 (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
50 (r'sed.*-i', "don't use 'sed -i', use a temporary file"),
49 (r'sed.*-i', "don't use 'sed -i', use a temporary file"),
51 (r'echo.*\\n', "don't use 'echo \\n', use printf"),
50 (r'echo.*\\n', "don't use 'echo \\n', use printf"),
52 (r'echo -n', "don't use 'echo -n', use printf"),
51 (r'echo -n', "don't use 'echo -n', use printf"),
53 (r'^diff.*-\w*N', "don't use 'diff -N'"),
54 (r'(^| )wc[^|]*$\n(?!.*\(re\))', "filter wc output"),
52 (r'(^| )wc[^|]*$\n(?!.*\(re\))', "filter wc output"),
55 (r'head -c', "don't use 'head -c', use 'dd'"),
53 (r'head -c', "don't use 'head -c', use 'dd'"),
56 (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"),
54 (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"),
@@ -62,10 +60,8 b' testpats = ['
62 (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w',
60 (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w',
63 "use egrep for extended grep syntax"),
61 "use egrep for extended grep syntax"),
64 (r'/bin/', "don't use explicit paths for tools"),
62 (r'/bin/', "don't use explicit paths for tools"),
65 (r'\$PWD', "don't use $PWD, use `pwd`"),
66 (r'[^\n]\Z', "no trailing newline"),
63 (r'[^\n]\Z', "no trailing newline"),
67 (r'export.*=', "don't export and assign at once"),
64 (r'export.*=', "don't export and assign at once"),
68 (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\^', "^ must be quoted"),
69 (r'^source\b', "don't use 'source', use '.'"),
65 (r'^source\b', "don't use 'source', use '.'"),
70 (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"),
66 (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"),
71 (r'ls +[^|\n-]+ +-', "options to 'ls' must come before filenames"),
67 (r'ls +[^|\n-]+ +-', "options to 'ls' must come before filenames"),
@@ -79,7 +75,12 b' testpats = ['
79 (r'^( *)\t', "don't use tabs to indent"),
75 (r'^( *)\t', "don't use tabs to indent"),
80 ],
76 ],
81 # warnings
77 # warnings
82 []
78 [
79 (r'^function', "don't use 'function', use old style"),
80 (r'^diff.*-\w*N', "don't use 'diff -N'"),
81 (r'\$PWD', "don't use $PWD, use `pwd`"),
82 (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\^', "^ must be quoted"),
83 ]
83 ]
84 ]
84
85
85 testfilters = [
86 testfilters = [
@@ -106,9 +107,9 b' utestpats = ['
106 for i in [0, 1]:
107 for i in [0, 1]:
107 for p, m in testpats[i]:
108 for p, m in testpats[i]:
108 if p.startswith(r'^'):
109 if p.startswith(r'^'):
109 p = r"^ \$ (%s)" % p[1:]
110 p = r"^ [$>] (%s)" % p[1:]
110 else:
111 else:
111 p = r"^ \$ .*(%s)" % p
112 p = r"^ [$>] .*(%s)" % p
112 utestpats[i].append((p, m))
113 utestpats[i].append((p, m))
113
114
114 utestfilters = [
115 utestfilters = [
@@ -613,12 +613,25 b''
613 tests/test-commandserver.py:0:
613 tests/test-commandserver.py:0:
614 > print '%c, %r' % (ch, re.sub('encoding: [a-zA-Z0-9-]+', 'encoding: ***', data))
614 > print '%c, %r' % (ch, re.sub('encoding: [a-zA-Z0-9-]+', 'encoding: ***', data))
615 warning: line over 80 characters
615 warning: line over 80 characters
616 tests/test-convert-mtn.t:0:
617 > > function get_passphrase(keypair_id)
618 don't use 'function', use old style
616 tests/test-filecache.py:0:
619 tests/test-filecache.py:0:
617 > except:
620 > except:
618 warning: naked except clause
621 warning: naked except clause
619 tests/test-filecache.py:0:
622 tests/test-filecache.py:0:
620 > if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'], 'cacheable']):
623 > if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'], 'cacheable']):
621 warning: line over 80 characters
624 warning: line over 80 characters
625 tests/test-import-git.t:0:
626 > > Mc\${NkU|\`?^000jF3jhEB
627 ^ must be quoted
628 tests/test-import.t:0:
629 > > diff -Naur proj-orig/foo proj-new/foo
630 don't use 'diff -N'
631 don't use 'diff -N'
632 tests/test-schemes.t:0:
633 > > z = file:\$PWD/
634 don't use $PWD, use `pwd`
622 tests/test-ui-color.py:0:
635 tests/test-ui-color.py:0:
623 > testui.warn('warning\n')
636 > testui.warn('warning\n')
624 warning: unwrapped ui message
637 warning: unwrapped ui message
General Comments 0
You need to be logged in to leave comments. Login now