Skip to content
Snippets Groups Projects
Commit e128fa46 authored by Matt Mackall's avatar Matt Mackall
Browse files

check-code: add some basic support for unified tests

parent 8a5b6383
No related branches found
No related tags found
No related merge requests found
......@@ -70,6 +70,26 @@
(r"<<(\S+)((.|\n)*?\n\1)", rephere),
]
uprefix = r"^ \$ "
utestpats = [
(uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
(uprefix + r'.*\$\?', "explicit exit code checks unnecessary"),
(uprefix + r'.*\|\| echo.*(fail|error)',
"explicit exit code checks unnecessary"),
(uprefix + r'set -e', "don't use set -e"),
]
for p, m in testpats:
if p.startswith('^'):
p = uprefix + p[1:]
else:
p = uprefix + p
utestpats.append((p, m))
utestfilters = [
(r"( *)(#([^\n]*\S)?)", repcomment),
]
pypats = [
(r'^\s*def\s*\w+\s*\(.*,\s*\(',
"tuple parameter unpacking not available in Python 3+"),
......@@ -157,6 +177,7 @@
('python', r'.*\.(py|cgi)$', pyfilters, pypats),
('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats),
('c', r'.*\.c$', cfilters, cpats),
('unified test', r'.*\.t$', utestfilters, utestpats),
]
class norepeatlogger(object):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment