Skip to content

Conversation

fjahr
Copy link
Contributor

@fjahr fjahr commented Apr 5, 2022

The new python version should produce the exact same output as the bash version but be easier to maintain.

vulture_args = ['vulture', '--min-confidence=100'] + files

try:
check_output(vulture_args, stderr=STDOUT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this print the error? I'd guess no

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, for me it does. It doesn't for you?

(faked to get an alert)

$ test/lint/lint-python-dead-code.py
/Users/FJ/projects/clones/bitcoin/test/lint/lint-python-dead-code.py:26: unsatisfiable 'if' condition (100% confidence)
Python dead code detection found some issues

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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? 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry. I missed the e.output.decode two lines below. 🤦‍♂️

@maflcko
Copy link
Member

maflcko commented Apr 6, 2022

review ACK 076cd68

The three (3) CI failures are unrelated and can be ignored (:smiling_face_with_tear:)

@maflcko maflcko merged commit d3ff026 into bitcoin:master Apr 6, 2022
@laanwj laanwj mentioned this pull request Apr 6, 2022
25 tasks
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 6, 2022
…thon

076cd68 lint: Convert Python dead code linter to Python (Fabian Jahr)

Pull request description:

  The new python version should produce the exact same output as the bash version but be easier to maintain.

ACKs for top commit:
  MarcoFalke:
    review ACK 076cd68

Tree-SHA512: 6d71a5230d612a981958fb6e178214240b09e842ffe35e207cbbda870ca35476626bf832f55d96f2fc7323a2875935edfee30cacef659a8e6ec4bbb28ff6e36a
@bitcoin bitcoin locked and limited conversation to collaborators Apr 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants