check-config: look for ui.configwith
We previously weren't looking for this config helper. And, surprise,
profiling.py references config options without docs.
If I tried hard enough, I could have combined the regexps using a
positive lookbehind assertion or something. But I didn't want to make
my brain explode.
At some point, we should probably do this linting at the tokenizer or
ast layer. I'm not willing to open that can of worms right now.
--- a/contrib/check-config.py Thu Jun 15 10:38:19 2017 -0700
+++ b/contrib/check-config.py Thu Jun 15 10:58:36 2017 -0700
@@ -24,6 +24,16 @@
(?:default=)?(?P<default>\S+?))?
\)''', re.VERBOSE | re.MULTILINE)
+configwithre = re.compile('''
+ ui\.config(?P<ctype>with)\(
+ # First argument is callback function. This doesn't parse robustly
+ # if it is e.g. a function call.
+ [^,]+,\s*
+ ['"](?P<section>\S+)['"],\s*
+ ['"](?P<option>\S+)['"](,\s+
+ (?:default=)?(?P<default>\S+?))?
+ \)''', re.VERBOSE | re.MULTILINE)
+
configpartialre = (r"""ui\.config""")
def main(args):
@@ -79,7 +89,7 @@
# look for code-like bits
line = carryover + l
- m = configre.search(line)
+ m = configre.search(line) or configwithre.search(line)
if m:
ctype = m.group('ctype')
if not ctype:
--- a/tests/test-check-config.t Thu Jun 15 10:38:19 2017 -0700
+++ b/tests/test-check-config.t Thu Jun 15 10:58:36 2017 -0700
@@ -33,3 +33,5 @@
$ hg files "set:(**.py or **.txt) - tests/**" | sed 's|\\|/|g' |
> python contrib/check-config.py
+ undocumented: profiling.showmax (with) [0.999]
+ undocumented: profiling.showmin (with) [0.005]