fix(bloc_lint): reset the @override flag between class members - #4864
Open
mysCod3r wants to merge 1 commit into
Open
fix(bloc_lint): reset the @override flag between class members#4864mysCod3r wants to merge 1 commit into
@override flag between class members#4864mysCod3r wants to merge 1 commit into
Conversation
`_isOverride` was only written from `beginMetadata`, which fires only for annotated declarations, so the flag was never cleared. An `@override` on one member exempted every member after it, and a member carrying `@override` plus a second annotation was reported despite the exemption. Clear the flag on `beginMetadataStar`, which fires for every member before its metadata, and accumulate in `beginMetadata` rather than assigning. Closes felangel#4863
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.
Status
READY
Breaking Changes
NO
Description
@overrideflag between class members (closes fix:_isOverrideis never reset, so lint rules skip every member after an@override#4863)avoid_public_bloc_methodsandprefer_void_public_cubit_methodseach keep an_isOverrideflag that was only ever written frombeginMetadata, which fires only for declarations that have an annotation. The flag was therefore never cleared, so an@overrideon one member exempted every member after it, and a member annotated with@overrideplus anything else was reported despite the exemption.beginMetadataStarfires for every member before its metadata is read, so it is the point at which the flag can be cleared.beginMemberis not usable for this, since it runs after the metadata and clearing there would drop a legitimate@override.Both rules now clear the flag on
beginMetadataStarand accumulate inbeginMetadatainstead of assigning, which fixes the false negative and the false positive respectively.Three regression tests are included, one per defect plus the
avoid_public_bloc_methodscase. Each fails without the change and passes with it. The suite goes from 151 to 154 tests, andbloc_lintstays at 100% coverage.Type of Change