-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
434 Pylint alerts corrections as part of intervention experiment #439
Open
evidencebp
wants to merge
16
commits into
brechtm:master
Choose a base branch
from
evidencebp:master
base: master
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
The method write_log had 6 nesting levels, while the recommendation is at most 5. I extracted two nested methods, _log_entries and in it _handle_source. The methods extraction also fixed too-many-branches and too-many-statements in that method.
The constructors, that handles many format values, had too many branches. I extracting handling format 4 into a dedicated method.
Method children had many branches computing the text variable. I extracted those base on the type value into _handle_type and replaces these branches with a single one, checking if the type is relevant.
Method __new__ of the class WithAttributes had too many branches. I extracted a static method _handle_bases handing base classes logic.
The function main had 116 statements (more than the recommended limit of 50). Most code handle different unrelated args so I extracted methods for them.
Remove two unneeded parenthesis
Made two readable line shorter
Function run_length_encoder had 14 branches (limit is 12). Extracted the _handle_byte function
remove unneeded parenthesis
Function check_time had 7 returns I kept the return value and return it in the end of the function, avoiding too many point of exit. Other than the return there is also an exception in case the the type is not supported.
Method render of class LabeledFlowable had 14 branches. Extracted the method _compute_spillover to structure and reduce branches
__all__ = ("Hyphenator") while it should be a list (e.g. __all__ = ["Hyphenator"]). Seems like a bug. https://stackoverflow.com/questions/44834/what-does-all-mean-in-python
Method _spans_to_words of class ParagraphState had 7 nesting levels. I extracted _process_groups that goes over the groups to reduce that.
Method read_dictionary_or_stream of class PDFObjectReader had 6 nesting levels. I extracted _handle_filter that takes only the dictionary as a parameter and encapsulates the creation of the stream_filter.
The constructor of AdobeFontMetricsParser had 14 branches. I extracted _process_line with the content of the loop going over lines.
Code uses from rinoh.styleds import * This hides the imoported objects and might lead to collisions in the future if objects of the same name are imported with wildcards. styleds is a collection of imports, aimed to ease related imports. I copied the used imports from there and deleted the unused ones. This adds many imports and does not benefits from styleds, so this is a downside of fixing this alert.
evidencebp
added a commit
to evidencebp/pylint-intervention
that referenced
this pull request
Oct 28, 2024
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.
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.
The PR is still work in progress and created now to present the changes and consult.