Account for selector specificity when merging extend_unsafe_fixes and override extend_safe_fixes#8444
Merged
zanieb merged 8 commits intoastral-sh:mainfrom Nov 7, 2023
Conversation
zanieb
reviewed
Nov 2, 2023
Member
zanieb
left a comment
There was a problem hiding this comment.
Thank you for contributing! I have some questions about simplifying the implementation but otherwise this looks great.
extend_unsafe_fixes and override extend_safe_fixes
Contributor
|
Contributor
Author
|
I was going to ask if there is a chance this will make it to the next release, but I see the release happened yesterday :) is this good to go as is @zanieb? |
Member
|
Sorry for the delay this one got lost! |
zanieb
approved these changes
Nov 7, 2023
Contributor
Author
|
LGTM |
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
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.
Summary
Prior to this change
extend_unsafe_fixestook precedence overextend_safe_fixesselectors, so any conflicts were resolved in favour ofextend_unsafe_fixes. Thanks to that ruff were conservatively assuming that if configs conlict the fix corresponding to selected rule will be treated as unsafe.After this change we take into account Specificity of the selectors. For conflicts between selectors of the same Specificity we will treat the corresponding fixes as unsafe. But if the conflicting selectors are of different specificity the more specific one will win.
Test Plan
Tests were added for the
FixSafetyTablestruct. Thecheck_extend_unsafe_fixes_conflict_with_extend_safe_fixes_by_specificityintegration test was added to test conflicting rules of different specificity.Fixes #8404