diff options
author | Chun Kuan Lee <ken2812221@gmail.com> | 2018-09-02 06:40:56 +0800 |
---|---|---|
committer | Chun Kuan Lee <ken2812221@gmail.com> | 2018-09-02 21:40:51 +0800 |
commit | 5d62dcf9cfb5c0b2511c10667ed47ec3b3610d72 (patch) | |
tree | 889a75810b9d906e72597ef8ed533db2aa0ed31a /test/lint | |
parent | bdbd654df8ddf5945256f2ccf85feae620f6f0d5 (diff) | |
download | bitcoin-5d62dcf9cfb5c0b2511c10667ed47ec3b3610d72.tar.xz |
lint: Make sure we read the command line inputs using utf-8 decoding in python
Diffstat (limited to 'test/lint')
-rwxr-xr-x | test/lint/check-doc.py | 4 | ||||
-rwxr-xr-x | test/lint/lint-python-utf8-encoding.sh | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/test/lint/check-doc.py b/test/lint/check-doc.py index ab8e0e57d1..0c4a603167 100755 --- a/test/lint/check-doc.py +++ b/test/lint/check-doc.py @@ -26,8 +26,8 @@ SET_DOC_OPTIONAL = set(['-rpcssl', '-benchmark', '-h', '-help', '-socks', '-tor' def main(): - used = check_output(CMD_GREP_ARGS, shell=True, universal_newlines=True) - docd = check_output(CMD_GREP_DOCS, shell=True, universal_newlines=True) + used = check_output(CMD_GREP_ARGS, shell=True, universal_newlines=True, encoding='utf8') + docd = check_output(CMD_GREP_DOCS, shell=True, universal_newlines=True, encoding='utf8') args_used = set(re.findall(re.compile(REGEX_ARG), used)) args_docd = set(re.findall(re.compile(REGEX_DOC), docd)).union(SET_DOC_OPTIONAL) diff --git a/test/lint/lint-python-utf8-encoding.sh b/test/lint/lint-python-utf8-encoding.sh index 14183a5ccf..d03c20205d 100755 --- a/test/lint/lint-python-utf8-encoding.sh +++ b/test/lint/lint-python-utf8-encoding.sh @@ -17,4 +17,12 @@ if [[ ${OUTPUT} != "" ]]; then echo "${OUTPUT}" EXIT_CODE=1 fi +OUTPUT=$(git grep "check_output(" -- "*.py" | grep "universal_newlines=True" | grep -vE "encoding=.(ascii|utf8|utf-8).") +if [[ ${OUTPUT} != "" ]]; then + echo "Python's check_output(...) seems to be used to get program outputs without explicitly" + echo "specifying encoding=\"utf8\":" + echo + echo "${OUTPUT}" + EXIT_CODE=1 +fi exit ${EXIT_CODE} |