microsoft / mvnfeed-cli

Tool to transfer Maven artifacts between repositories
MIT License
28 stars 25 forks source link

Declare as global undefined variables 'upload_url' and 'download_url' #3

Closed cclauss closed 5 years ago

cclauss commented 5 years ago

upload_url and download_url are undefined names in this context that have the potential to raise NameError at runtime.

flake8 testing of https://github.com/microsoft/mvnfeed-cli on Python 3.7.1

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./src/mvnfeed_modules/mvnfeed-cli-transfer/mvnfeed/cli/transfer/configuration.py:48:8: F821 undefined name 'upload_url'
    if upload_url is None and download_url is None:
       ^
./src/mvnfeed_modules/mvnfeed-cli-transfer/mvnfeed/cli/transfer/configuration.py:48:31: F821 undefined name 'download_url'
    if upload_url is None and download_url is None:
                              ^
2     F821 undefined name 'upload_url'
2

E901,E999,F821,F822,F823 are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. Most other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety.

vbossica commented 5 years ago

Thank you for your PR. I really appreciate it.

The underlying bug was that upload_url and download_url were replaced by url... except on this particular line. This has now been fixed on master.

But you reminded me to run flake8 and pylint on the code base.