summaryrefslogtreecommitdiff
path: root/.gitlab
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-10-03 12:05:58 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-10-29 03:46:59 -0400
commitdb43b3b3079842fb2baf6d181ef39374acf0053c (patch)
tree388c405e3bae298da97df170488591e7f036040d /.gitlab
parent28e527327753ec9971a98ac19e050d9b0664bc40 (diff)
downloadhaskell-db43b3b3079842fb2baf6d181ef39374acf0053c.tar.gz
linters: Add linter to catch unquoted use of $(TEST_HC)
This is a common bug that creeps into Makefiles (e.g. see T12674).
Diffstat (limited to '.gitlab')
-rwxr-xr-x.gitlab/linters/check-makefiles.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/.gitlab/linters/check-makefiles.py b/.gitlab/linters/check-makefiles.py
index 19b7b56368..b36b073cba 100755
--- a/.gitlab/linters/check-makefiles.py
+++ b/.gitlab/linters/check-makefiles.py
@@ -1,19 +1,31 @@
#!/usr/bin/env python3
"""
+Linters for testsuite makefiles
+"""
+
+from linter import run_linters, RegexpLinter
+
+"""
Warn for use of `--interactive` inside Makefiles (#11468).
Encourage the use of `$(TEST_HC_OPTS_INTERACTIVE)` instead of
`$(TEST_HC_OPTS) --interactive -ignore-dot-ghci -v0`. It's too easy to
forget one of those flags when adding a new test.
"""
-
-from linter import run_linters, RegexpLinter
-
-linters = [
+interactive_linter = \
RegexpLinter(r'--interactive',
message = "Warning: Use `$(TEST_HC_OPTS_INTERACTIVE)` instead of `--interactive -ignore-dot-ghci -v0`."
).add_path_filter(lambda path: path.name == 'Makefile')
+
+test_hc_quotes_linter = \
+ RegexpLinter('\t\\$\\(TEST_HC\\)',
+ message = "Warning: $(TEST_HC) should be quoted in Makefiles.",
+ ).add_path_filter(lambda path: path.name == 'Makefile')
+
+linters = [
+ interactive_linter,
+ test_hc_quotes_linter,
]
if __name__ == '__main__':