testsuite: make CHECK_API_ANNOTATIONS and CHECK_PPR overridable
[ghc.git] / .arc-linters / check-makefiles.py
1 #!/usr/bin/env python3
2
3 # Warn for use of `--interactive` inside Makefiles (#11468).
4 #
5 # Encourage the use of `$(TEST_HC_OPTS_INTERACTIVE)` instead of
6 # `$(TEST_HC_OPTS) --interactive -ignore-dot-ghci -v0`. It's too easy to
7 # forget one of those flags when adding a new test.
8
9 import sys
10 import os
11 import json
12 import re
13
14 path = sys.argv[1]
15 warnings = []
16 if os.path.isfile(path):
17 with open(path) as f:
18 for lineno, line in enumerate(f):
19 if '--interactive' in line:
20 warning = {
21 'severity': 'warning',
22 'message': 'Use `$(TEST_HC_OPTS_INTERACTIVE)` instead of `--interactive -ignore-dot-ghci -v0`',
23 'line': lineno+1,
24 }
25 warnings.append(warning)
26
27 print(json.dumps(warnings))