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

Pylint alerts corrections as part of an intervention experiment 1853 #208

Merged
merged 19 commits into from
Nov 25, 2024

Conversation

evidencebp
Copy link
Contributor

@evidencebp evidencebp commented Nov 18, 2024

Makes the interventions describe in intervention issue.
The experiment is described here.

Each intervention was done in a dedicated commit with a message explaining it.

As we discussed, I created first a PR with the minor simple alerts:mline-too-long, unnecessary-pass, and broad-exception-caught.
I hope that the review will be easy.

Made too line shorter.
One was not readable.
Made a readable line shorter
Made unreadable commented out line shorter.
Made a readable line shorter
unneeded pass in the end of exception handling
Catching Exception might hide unexpected exceptions (e.g., due to new code that will be added).
More than that, the exception handling does not log it but returns None, making it harder to detect.
I changed it to catching  requests.exceptions.HTTPError
See
https://stackoverflow.com/questions/24518944/try-except-when-using-python-requests-module
Catching Exception might hide unexpected exceptions (e.g., due to new code that will be added).

The method parse calls R2DTResultInfo.validate (in line 96).Validate is a sequence of assertions, hence the specific AssertionError can be used instead.

See
https://stackoverflow.com/questions/1569049/making-pythons-assert-throw-an-exception-that-i-choose
…caught

Catching Exception might hide unexpected exceptions (e.g., due to new code that will be added).  

The function ftp calls ftplib.FTP's quit (in line 40).
The specific ftplib.all_errors   can be used instead.  

See 
https://docs.python.org/3/library/ftplib.html
The function fallback calls fetch.lookup (in line 41). I changed to (fetch.UnknownReference, fetch.TooManyPublications) as discussed. Please note that I could not find where TooManyPublications is defined
As discussed, narrowed Exception to ValueError
@blakesweeney
Copy link
Member

'
Hi,

Thanks for your contribution to RNAcentral. I'''ve take a look over the changes and I think they are fine. I'''m a little worried about the formatting changes. Generally we use black to format things, which may end up conflicting with these changes. I will approve them even if they later get changed again. I think pylint also formatted some comments and docstrings which would also be useful.

The exception handling also seems fine, so we can go ahead with this change.'

@blakesweeney blakesweeney merged commit 8a3abb9 into RNAcentral:master Nov 25, 2024
@evidencebp
Copy link
Contributor Author

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants