aboutsummaryrefslogtreecommitdiff
path: root/contrib/devtools/check-doc.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-05-19 10:27:54 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-05-24 12:02:15 -0400
commitfa3c910bfeab00703c947c5200a64c21225b50ef (patch)
tree6d8e8ad2d248c22fece1f5c1bebd6cf9ace38db0 /contrib/devtools/check-doc.py
parentd9ebb63919fb311ace0ae977e3183ccb80ed7d3c (diff)
test: Move linters to test/lint, add readme
Diffstat (limited to 'contrib/devtools/check-doc.py')
-rwxr-xr-xcontrib/devtools/check-doc.py48
1 files changed, 0 insertions, 48 deletions
diff --git a/contrib/devtools/check-doc.py b/contrib/devtools/check-doc.py
deleted file mode 100755
index de5719eb29..0000000000
--- a/contrib/devtools/check-doc.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2015-2017 The Bitcoin Core developers
-# Distributed under the MIT software license, see the accompanying
-# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-'''
-This checks if all command line args are documented.
-Return value is 0 to indicate no error.
-
-Author: @MarcoFalke
-'''
-
-from subprocess import check_output
-import re
-import sys
-
-FOLDER_GREP = 'src'
-FOLDER_TEST = 'src/test/'
-REGEX_ARG = '(?:ForceSet|SoftSet|Get|Is)(?:Bool)?Args?(?:Set)?\("(-[^"]+)"'
-REGEX_DOC = 'AddArg\("(-[^"=]+?)(?:=|")'
-CMD_ROOT_DIR = '`git rev-parse --show-toplevel`/{}'.format(FOLDER_GREP)
-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(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()