Skip to content

Commit c82190c

Browse files
tests: Add Python dead code linter (vulture)
1 parent 590a57f commit c82190c

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

.travis/lint_04_install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ export LC_ALL=C
88

99
travis_retry pip install codespell==1.13.0
1010
travis_retry pip install flake8==3.5.0
11+
travis_retry pip install vulture==0.29

test/lint/lint-python-dead-code.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2018 The Bitcoin Core developers
4+
# Distributed under the MIT software license, see the accompanying
5+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
6+
#
7+
# Find dead Python code.
8+
9+
export LC_ALL=C
10+
11+
if ! command -v vulture > /dev/null; then
12+
echo "Skipping Python dead code linting since vulture is not installed. Install by running \"pip3 install vulture\""
13+
exit 0
14+
fi
15+
16+
vulture \
17+
--min-confidence 60 \
18+
--ignore-names "argtypes,connection_lost,connection_made,converter,data_received,daemon,errcheck,get_ecdh_key,get_privkey,is_compressed,is_fullyvalid,msg_generic,on_*,optionxform,restype,set_privkey" \
19+
$(git ls-files -- "*.py" ":(exclude)contrib/")

0 commit comments

Comments
 (0)