-
Notifications
You must be signed in to change notification settings - Fork 69
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 1560 #1568
Open
evidencebp
wants to merge
37
commits into
cmu-delphi:dev
Choose a base branch
from
evidencebp:dev
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Removed unneeded parenthesis
The code was def dummy_gen(): if 3 >4: yield {} Clearly, the dummy_gen is not intended to reach the yield. To clarify that, I changed the condition to False. I still wonder why the function is needed.
Method prepare_measurements of class QuidelData had 19 branches while Pylint recommends having at most 12. I extracted the methods _prepare_device_id and to make the code more structured and solve that.
Function upload had 68 statements while Pylint recommends having at most 50. I added the cursor as a parameter to its external functions and moved them out.
Function create_printer had 7 returns while Pylint recommends having at most 6. The code checks for a list of options. I removed some into a dictionary. I also assigned the results into a variable and used a single return at the end of the function.
Static method extract_and_check_row of class CsvImporter had 14 returns while Pylint recommends having at most 6. I extracted the functions _validate_geo_type and _validate_geo_id to make the code more structured and solve that.
Method insert_dataset of class Database had 13 branches while Pylint recommends having at most 12. I extracted the method _process_rows to make the code more structured and solve that.
Function handle_meta had 65 statements while Pylint recommends having at most 50. I extracted _process_signals to make the code more structured and solve that.
Function run had 24 branches while Pylint recommends having at most 12. I extracted the debug_log function (print in debug mode) which is reused a few times. I also extracted methods to make the code more structured and solve that.
Function update had 56 statements while Pylint recommends having at most 50. I extracted _process_values to make the code more structured and solve that.
Wildcard imports (import *) make it harder to understand what is imported from where. Removing it is also a defensive programming act, lowering the probability of collisions due to future new imports or objects. Instead, I imported explicitly delta_epiweeks, add_epiweeks from delphi.utils.epiweek (line 85)
Catching Exception might hide unexpected exceptions (e.g., due to new code that will be added). Static method _request of class Epidata catches exception (line 134) The try section is basically request.get Exception was changed to requests.exceptions.JSONDecodeError , requests.exceptions.HTTPError , requests.exceptions.Timeout , requests.exceptions.TooManyRedirects , and requests.exceptions.RequestException For details see https://requests.readthedocs.io/en/latest/user/quickstart/#make-a-request Same happened in static method _version_check (line 63). Added there also AttributeError due to looking for ['info']['version'] in line 62.
Catching Exception might hide unexpected exceptions (e.g., due to new code that will be added). Function update_from_data catches exception (line 152) The try section is cursor's execute Exception was changed to mysql.connector.Error For details see https://dev.mysql.com/doc/connector-python/en/connector-python-api-errors-error.html
Made query more readable
Made unreadable line shorter
Made readable lines shorter
…long Made readable lines shorter
Made readable lines shorter. Email body is more readable.
Made unreadable line shorter
Made readable line shorter
Made unreadable line shorter
Made query more readable
Made query more readable
Made unreadable line shorter
Used a single assignment per variable, made query more readable
Made readable lines shorter
Made readable lines shorter
Made readable lines shorter
Made readable line shorter
Made readable lines shorter
Made url more readable
Made unreadable query structured
made readable query more structured
Made readable line shorter
Made readable lines shorter
Quality Gate passedIssues Measures |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
addresses issue(s) #ISSUE 1560
Summary:
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.
Prerequisites:
dev
branchdev