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 1500 #1501

Open
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

evidencebp
Copy link

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.

Function read_buffer had 56 branches while Pylint recommends having at most 12.
Now there is a function process_line that uses more utility functions.
Function write had 69 statements while Pylint recommends having at most 50.
Function read_buffer had 65 statements .
Extracted functions to make the code more structured and solve that.
Function _read_faces had 54 statements while Pylint recommends having at most 50.
Now there are dedicated functions _read_faces_ascii and _read_faces_binary
Function _write_buffer had 55 statements while Pylint recommends having at most 50.
Extracted _write_cells to make the code more structured and solve that.
Function translate_cells had 52 statements while Pylint recommends having at most 50.
Extracted _process_polygon_cells to make the code more structured and solve that.
Function split_f_z had 78 statements while Pylint recommends having at most 50.
Extracted methods to make the code more structured and solve that.
Function read_buffer had 90 statements while Pylint recommends having at most 50.
Extracted methods that handle the various names to make the code more structured and solve that.
Function write had 93 statements while Pylint recommends having at most 50.
Function read had 54 statements.
I extracted methods to make the code more structured and solve that.
Function read_buffer had 56 statements while Pylint recommends having at most 50.
Function write had 64 statements.
I extracted methods to make the code more structured and solve that.
Function _read_section had 53 statements while Pylint recommends having at most 50.
I extracted _read_cell_offsets_and_connectivity to make the code more structured and solve that.
Function read_set excepted ValueError in line 218 and did raise immediately.
This is equivalent to not catching yet more complex.
I removed the exception handling.
Catching Exception might hide unexpected exceptions (e.g., due to new code that will be added).
Function parse_articles  catches Exception (line 12)

The try section is

__version__ = metadata.version("meshio")

Exception was changed to metadata.PackageNotFoundError

For details see
https://docs.python.org/3/library/importlib.metadata.html
Function _write_entities had 6 nested-blocks while Pylint recommends having at most 5.
I extracted _write_bounding_entities to make the code more structured and solve that.
Function read_binary_buffer had 18 branches while Pylint recommends having at most 12.
Function read_ascii_buffer had 24 branches.
I extracted methods, aggregated similar code into a dicrtionary,  and add the line checking to the while loop to make the code more structured and solve that.
Method __init__  (constructor) of class VtuReader had 39 branches while Pylint recommends having at most 12.
Function write had 40 branches.
Extracted many methods to make the code more structured and solve that.
Function read_buffer had 14 branches while Pylint recommends having at most 12.
Extracted _merge_cell_tags_into_cell_data to make the code more structured and solve that.
Function read had 27 branches while Pylint recommends having at most 12.
I extracted methods to make the code more structured and solve that.
Function categorize had 14 branches.
I extracted _lookup that is used three times there.
Function categorize had 13 branches while Pylint recommends having at most 12.
Extracted _write_compressed to make the code more structured and solve that.
Function write had 15 branches while Pylint recommends having at most 12.
Extracted _process_attr_refs and used it twice.
The constructor of class TimeSeriesReader had 16 branches while Pylint recommends having at most 12.
I extracted find_grid_collection to make the code more structured and solve that.
Method _read_data_item of class TimeSeriesReader had 13 branches while Pylint recommends having at most 12.
Extracted _get_data_type_and_precision to make the code more structured and solve that.
Function _read_mesh had 13 branches while Pylint recommends having at most 12.
I extracted _handle_vertices to make the code more structured and solve that.
Function _read_cells had 14 branches while Pylint recommends having at most 12.
I extracted _identify_entity to make the code more structured and solve that.
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.

1 participant