summaryrefslogtreecommitdiff
path: root/.arc-linters
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
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')
-rwxr-xr-x.arc-linters/check-cpp.py3
-rw-r--r--.arc-linters/check-makefiles.py27
2 files changed, 28 insertions, 2 deletions
diff --git a/.arc-linters/check-cpp.py b/.arc-linters/check-cpp.py
index 1d07b4ed37..2f32f9be6a 100755
--- a/.arc-linters/check-cpp.py
+++ b/.arc-linters/check-cpp.py
@@ -7,7 +7,6 @@ import sys
import logging
import os
import json
-import re
def setup_logging(logger):
"""
@@ -28,7 +27,7 @@ warnings = []
if os.path.isfile(path):
with open(path) as f:
for lineno, line in enumerate(f):
- if re.search('ASSERT \(', line) is not None:
+ if 'ASSERT (' in line:
warning = {
'severity': 'warning',
'message': 'CPP macros should not have a space between the macro name and their argument list',
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))