-
Notifications
You must be signed in to change notification settings - Fork 7
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
CPLAT-9677 Improve class migration short-circuit logic + consumer communication #82
CPLAT-9677 Improve class migration short-circuit logic + consumer communication #82
Conversation
+ The advanced class migrator shouldn’t be removing @props() / @AbstractProps() annotations - we have another migrator for that. The removal of these annotations was causing the “companion” classes to not be removed when the class first had its annotation removed. + Also, the annotations should remain on the concrete class - not moved to the mixin
# Conflicts: # lib/src/boilerplate_suggestors/boilerplate_utilities.dart # lib/src/executables/boilerplate_upgrade.dart # test/boilerplate_suggestors/advanced_props_and_state_class_migrator_test.dart # test/boilerplate_suggestors/simple_props_and_state_class_migrator_test.dart # test/boilerplate_suggestors/stubbed_props_and_state_class_remover_test.dart
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on Slack: #support-infosec. |
+ This metadata will get removed by the AnnotationsRemover anyway, so there is no reason to add the complexity here.
+ This allows us to operate on newly created mixins when migrators run after their creation. + Specifically, this is needed to ensure that props/state annotations are removed from newly created mixins by the AnnotationsRemover migrator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got through most of the changes, but it's dense so I thought I'd just send out what I had and finish up the review after lunch!
Overall, I like the new architecture for comments and keeping track of migrating decisions. I think it works well and makes it clear (or as clear as I can imagine) when comments should be posted. So that's awesome and I don't have any feedback on changes to how that works.
Otherwise just found some nits and small things!
lib/src/boilerplate_suggestors/advanced_props_and_state_class_migrator.dart
Outdated
Show resolved
Hide resolved
lib/src/boilerplate_suggestors/advanced_props_and_state_class_migrator.dart
Outdated
Show resolved
Hide resolved
lib/src/boilerplate_suggestors/advanced_props_and_state_class_migrator.dart
Outdated
Show resolved
Hide resolved
lib/src/boilerplate_suggestors/advanced_props_and_state_class_migrator.dart
Outdated
Show resolved
Hide resolved
test/boilerplate_suggestors/advanced_props_and_state_class_migrator_test.dart
Show resolved
Hide resolved
test/boilerplate_suggestors/advanced_props_and_state_class_migrator_test.dart
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to post this when I started reviewing a couple days ago 🤦♂
Starting another pass now...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final pass!
lib/src/boilerplate_suggestors/advanced_props_and_state_class_migrator.dart
Outdated
Show resolved
Hide resolved
test/boilerplate_suggestors/advanced_props_and_state_class_migrator_test.dart
Outdated
Show resolved
Hide resolved
test/boilerplate_suggestors/advanced_props_and_state_class_migrator_test.dart
Outdated
Show resolved
Hide resolved
test/boilerplate_suggestors/advanced_props_and_state_class_migrator_test.dart
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+10
@Workiva/release-management-p |
Motivation
Currently, when the codemod runs the
AdvancedPropsAndStateClassMigrator
, the migrator does not short-circuit if a custom superclass, or one or more mixins is not present in the map of "known converted classes" that the migrators update as classes are converted.This is done because we have no way to control the order in which classes are visited by the suggestor. This means that just because a superclass or mixin is not present in the map of "known converted classes" at the time the subclass is visited - does not mean it will never be converted.
We also need to improve how we communicate to the consumer when our codemod short-circuits because of public API detection / superclasses from external libs.
Changes
ClassToMixinConverter
class to record visits, as well as record whether the class that was visited was converted.AdvancedPropsAndStateClassMigrator
twice during the migration.--convert-classes-with-external-superclasses
flag that can be set to force the conversion of classes that extend from or mix in classes that do not live in the same library.MigrationDecision
class that is responsible for determining when short-circuits occur during migrations, as well as storing areason
comment that we will apply to keep the consumers informed about what they can do to either migrate the classes manually, or to make some adjustments before running the migration script again.StubbedPropsAndStateClassRemover
so that it runs with the knowledge of which classes have been converted.graph_ui
.Review
See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.
Please review: @joebingham-wk @sydneyjodon-wk @greglittlefield-wf
QA Checklist
Merge Checklist
While we perform many automated checks before auto-merging, some manual checks are needed: