You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since globals and nonlocals are rare, could we try instead running this rule on every global and nonlocal statement, and then, for each statement, mapping back to the containing Suite and looking for global statements that follow it repeatedly?
In other words... instead of iterating over every body / statement, can we instead run this for each global? You can look at traversal::next_sibling or traversal::suite (and their usages) for an example.
Since globals and nonlocals are rare, could we try instead running this rule on every global and nonlocal statement, and then, for each statement, mapping back to the containing Suite and looking for global statements that follow it repeatedly?
In other words... instead of iterating over every body / statement, can we instead run this for each global? You can look at traversal::next_sibling or traversal::suite (and their usages) for an example.
@charliermarsh done.
Just a note: now the algorithm is quadratic on len(suite) for each suite containing global or nonlocal. Instead of linear (and should be auto vectorized) for each suite.
This file contains hidden or 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
previewRelated to preview mode featuresruleImplementing or modifying a lint rule
2 participants
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.
Summary
Implement repeated_global (FURB154) lint.
See:
Test Plan
cargo test