lint: Convert Python dead code linter test to Python #24778
pull fjahr wants to merge 1 commits into bitcoin:master from fjahr:202204-dead-py changing 3 files +42 −22-
fjahr commented at 11:00 pm on April 5, 2022: memberThe new python version should produce the exact same output as the bash version but be easier to maintain.
-
lint: Convert Python dead code linter to Python 076cd6835f
-
DrahtBot added the label Docs on Apr 5, 2022
-
DrahtBot added the label Tests on Apr 5, 2022
-
in test/lint/lint-python-dead-code.py:33 in 076cd6835f
28+ # --min-confidence 100 will only report code that is guaranteed to be unused within the analyzed files. 29+ # Any value below 100 introduces the risk of false positives, which would create an unacceptable maintenance burden. 30+ vulture_args = ['vulture', '--min-confidence=100'] + files 31+ 32+ try: 33+ check_output(vulture_args, stderr=STDOUT)
MarcoFalke commented at 6:09 am on April 6, 2022:Will this print the error? I’d guess no
fjahr commented at 6:49 am on April 6, 2022:Hm, for me it does. It doesn’t for you?
(faked to get an alert)
0$ test/lint/lint-python-dead-code.py 1/Users/FJ/projects/clones/bitcoin/test/lint/lint-python-dead-code.py:26: unsatisfiable 'if' condition (100% confidence) 2Python dead code detection found some issues
MarcoFalke commented at 7:01 am on April 6, 2022:Thanks for testing and confirming. I just assumed that redirecting stderr to stdout and then capturing stdout, which is done by
check_output
, which discards the return value here, would also drop the stderr.This is also what the documentation says:
https://docs.python.org/3/library/subprocess.html#subprocess.check_output
To also capture standard error in the result, use
stderr=subprocess.STDOUT
Not sure what to do now. Are you trying to trick me into installing
vulture
? :thinking:
MarcoFalke commented at 7:02 am on April 6, 2022:Oh, sorry. I missed thee.output.decode
two lines below. :man_facepalming:MarcoFalke approvedMarcoFalke commented at 7:05 am on April 6, 2022: memberreview ACK 076cd6835fd97a62bfd6912b80addfcb5342ea8e
The three (3) CI failures are unrelated and can be ignored (:smiling_face_with_tear:)
MarcoFalke merged this on Apr 6, 2022MarcoFalke closed this on Apr 6, 2022
sidhujag referenced this in commit 459274b683 on Apr 6, 2022DrahtBot locked this on Apr 6, 2023
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 21:12 UTC
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 21:12 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me