summaryrefslogtreecommitdiff
path: root/.arc-linters/check-makefiles.py
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2016-05-25 13:24:34 +0200
committerThomas Miedema <thomasmiedema@gmail.com>2016-05-27 22:49:29 +0200
commitd40682ec74d802376d7cf50f2d3612b3292b29c5 (patch)
treecfde4072ce14677621aa99d75a59228aea5922b1 /.arc-linters/check-makefiles.py
parentd0dd572b707631a104e060711faf9bd169bdc968 (diff)
downloadhaskell-d40682ec74d802376d7cf50f2d3612b3292b29c5.tar.gz
Testsuite: don't use --interactive in Makefiles
Add a linter to 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. Update submodule hpc. Reviewed by: austin Differential Revision: https://phabricator.haskell.org/D2265 GHC Trac Issues: #11468
Diffstat (limited to '.arc-linters/check-makefiles.py')
-rw-r--r--.arc-linters/check-makefiles.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/.arc-linters/check-makefiles.py b/.arc-linters/check-makefiles.py
new file mode 100644
index 0000000000..7080954477
--- /dev/null
+++ b/.arc-linters/check-makefiles.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+
+# 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.
+
+import sys
+import os
+import json
+import re
+
+path = sys.argv[1]
+warnings = []
+if os.path.isfile(path):
+ with open(path) as f:
+ for lineno, line in enumerate(f):
+ if '--interactive' in line:
+ warning = {
+ 'severity': 'warning',
+ 'message': 'Use `$(TEST_HC_OPTS_INTERACTIVE)` instead of `--interactive -ignore-dot-ghci -v0`',
+ 'line': lineno+1,
+ }
+ warnings.append(warning)
+
+print(json.dumps(warnings))