aboutsummaryrefslogtreecommitdiff
path: root/contrib/devtools
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-03-30 11:40:11 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-03-30 11:40:16 -0400
commit5e53b80b0280e6c564fc812188a838ce5889d86c (patch)
treec38e03d8553c0f49fbdd2fa26d2590a2d11219f4 /contrib/devtools
parentde7e5868417630422c563cde288bb5bdd03cfe97 (diff)
parent0c17e27630ada2d9284e357cc0e92ffff8775423 (diff)
Merge #12820: contrib: Fix check-doc script regexes
0c17e27630 init: Remove help text for non-existent -fuzzmessagestest arg (MarcoFalke) 136084470c contrib: Fix check-doc script regexes (MarcoFalke) Pull request description: Fixup the regexes to properly find all used args. The regex should now match all of the getter and setter methods of the `ArgsManager`. See https://dev.visucore.com/bitcoin/doxygen/class_args_manager.html#pub-methods Before: ``` Args used : 159 Args documented : 188 Args undocumented: 0 Args unknown : 29 ``` After: ``` Args used : 183 Args documented : 188 Args undocumented: 0 Args unknown : 5 ``` Tree-SHA512: 1a7fb7ea55b2f6030358a1055d8f2c19b31f69d0603be0b009e6e603564014b4e2bb824357c9d43d0fba3ce7159b7c4e7eaa60b3f962053d94f73d0e626294fc
Diffstat (limited to 'contrib/devtools')
-rwxr-xr-xcontrib/devtools/check-doc.py42
1 files changed, 22 insertions, 20 deletions
diff --git a/contrib/devtools/check-doc.py b/contrib/devtools/check-doc.py
index 4e87cdae82..0c2e1a24be 100755
--- a/contrib/devtools/check-doc.py
+++ b/contrib/devtools/check-doc.py
@@ -16,31 +16,33 @@ import sys
FOLDER_GREP = 'src'
FOLDER_TEST = 'src/test/'
+REGEX_ARG = '(?:ForceSet|SoftSet|Get|Is)(?:Bool)?Args?(?:Set)?\("(-[^"]+)"'
+REGEX_DOC = 'HelpMessageOpt\("(-[^"=]+?)(?:=|")'
CMD_ROOT_DIR = '`git rev-parse --show-toplevel`/{}'.format(FOLDER_GREP)
-CMD_GREP_ARGS = r"egrep -r -I '(map(Multi)?Args(\.count\(|\[)|Get(Bool)?Arg\()\"\-[^\"]+?\"' {} | grep -v '{}'".format(CMD_ROOT_DIR, FOLDER_TEST)
-CMD_GREP_DOCS = r"egrep -r -I 'HelpMessageOpt\(\"\-[^\"=]+?(=|\")' {}".format(CMD_ROOT_DIR)
-REGEX_ARG = re.compile(r'(?:map(?:Multi)?Args(?:\.count\(|\[)|Get(?:Bool)?Arg\()\"(\-[^\"]+?)\"')
-REGEX_DOC = re.compile(r'HelpMessageOpt\(\"(\-[^\"=]+?)(?:=|\")')
+CMD_GREP_ARGS = r"git grep --perl-regexp '{}' -- {} ':(exclude){}'".format(REGEX_ARG, CMD_ROOT_DIR, FOLDER_TEST)
+CMD_GREP_DOCS = r"git grep --perl-regexp '{}' {}".format(REGEX_DOC, CMD_ROOT_DIR)
# list unsupported, deprecated and duplicate args as they need no documentation
SET_DOC_OPTIONAL = set(['-rpcssl', '-benchmark', '-h', '-help', '-socks', '-tor', '-debugnet', '-whitelistalwaysrelay', '-prematurewitness', '-walletprematurewitness', '-promiscuousmempoolflags', '-blockminsize', '-dbcrashratio', '-forcecompactdb', '-usehd'])
+
def main():
- used = check_output(CMD_GREP_ARGS, shell=True, universal_newlines=True)
- docd = check_output(CMD_GREP_DOCS, shell=True, universal_newlines=True)
-
- args_used = set(re.findall(REGEX_ARG,used))
- args_docd = set(re.findall(REGEX_DOC,docd)).union(SET_DOC_OPTIONAL)
- args_need_doc = args_used.difference(args_docd)
- args_unknown = args_docd.difference(args_used)
-
- print("Args used : {}".format(len(args_used)))
- print("Args documented : {}".format(len(args_docd)))
- print("Args undocumented: {}".format(len(args_need_doc)))
- print(args_need_doc)
- print("Args unknown : {}".format(len(args_unknown)))
- print(args_unknown)
-
- sys.exit(len(args_need_doc))
+ used = check_output(CMD_GREP_ARGS, shell=True, universal_newlines=True)
+ docd = check_output(CMD_GREP_DOCS, shell=True, universal_newlines=True)
+
+ args_used = set(re.findall(re.compile(REGEX_ARG), used))
+ args_docd = set(re.findall(re.compile(REGEX_DOC), docd)).union(SET_DOC_OPTIONAL)
+ args_need_doc = args_used.difference(args_docd)
+ args_unknown = args_docd.difference(args_used)
+
+ print("Args used : {}".format(len(args_used)))
+ print("Args documented : {}".format(len(args_docd)))
+ print("Args undocumented: {}".format(len(args_need_doc)))
+ print(args_need_doc)
+ print("Args unknown : {}".format(len(args_unknown)))
+ print(args_unknown)
+
+ sys.exit(len(args_need_doc))
+
if __name__ == "__main__":
main()