blob: 4778b2d51a6c56f47ab05c4f5c29294b741c0076 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/usr/bin/env python3
# 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))
|