Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint failure: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from) #1115

Closed
jku opened this issue Aug 21, 2020 · 3 comments

Comments

@jku
Copy link
Member

jku commented Aug 21, 2020

https://travis-ci.org/github/theupdateframework/tuf/jobs/719237881

pylint seems to have been upgraded on travis -- or pip on python3.8 now installs pylint 2.6.0 based on the test output. This seems to make linter fail because of the added raise-missing-from check:

************* Module tuf.formats
/home/travis/build/theupdateframework/tuf/tuf/formats.py:958:4: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from)
/home/travis/build/theupdateframework/tuf/tuf/formats.py:964:4: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from)
************* Module tuf.repository_lib
/home/travis/build/theupdateframework/tuf/tuf/repository_lib.py:544:4: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from)
/home/travis/build/theupdateframework/tuf/tuf/repository_lib.py:573:4: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from)
/home/travis/build/theupdateframework/tuf/tuf/repository_lib.py:613:4: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from)
/home/travis/build/theupdateframework/tuf/tuf/repository_lib.py:669:4: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from)
************* Module tuf.keydb
/home/travis/build/theupdateframework/tuf/tuf/keydb.py:345:4: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from)
************* Module tuf.scripts.repo
/home/travis/build/theupdateframework/tuf/tuf/scripts/repo.py:458:6: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from)
************* Module tuf.client.updater
/home/travis/build/theupdateframework/tuf/tuf/client/updater.py:1589:10: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from)

We should consider "raise from" (although it's a bit of a pain with python2) or disable the linter check.

@jku
Copy link
Member Author

jku commented Aug 24, 2020

six.raise_from(exc_value, exc_value_from) is probably the reasonable choice: it keeps old functionality for py2 but uses 'raise from' on py3

@sechkova
Copy link
Contributor

Thanks, @jku, six is already used in the project for python 2.x compatibility so it does seem the best fit.
I opened #1116 based on your suggestion.

@lukpueh
Copy link
Member

lukpueh commented Aug 24, 2020

Kindly fixed in #1116. Thanks for the efforts @jku and @sechkova!

@lukpueh lukpueh closed this as completed Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants