-
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
Quick fix experiment #254
base: master
Are you sure you want to change the base?
Quick fix experiment #254
Conversation
// final intlPropMigrator = IntlMigrator(messages.className, messages); | ||
final constantStringMigrator = | ||
ConstantStringMigrator(messages.className, messages); | ||
// final importMigrator = (FileContext context) => |
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.
Should probably run the importer too, so unwind the change to run only a single migrator. But we shouldn't (I think) need the change that runs them all sequentially. Or we could let the IDE Extension still do the import.
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on Slack: #support-infosec. |
Motivation
The codemod is heavy, and designed for large migrations a package at a time. We'd like to be able to re-use the logic, but do it in a faster and much smaller way. This is an experiment in invoking something quickly that can make an individual change.
My thought is to write a special-purpose migrator that takes a file name and a character position. So if we give it a character position anywhere within a string it migrates just that string and exits.
Right now, all this does is run just the constant migrator on a single file. If it's already been compiled, then it runs in sub-second time. But that's not doing a
ddev format
on the _intl.dart file. So we could accept that and leave it unformatted, or we could make the IDE extension run the format on save operation, which is generally faster, or something else. I'm thinking something likedart pub global run over_react_codemod:intl_quick --character-position=12345 --file=lib/src/stuff/thing.dart
So this seems reasonably promising. The migrators can run without a resolved analysis, and do it pretty quickly.
We'd still need to validate we can call this from the IDE extensions easily and get the information we need. And things like revert would take some doing.
Changes
Release Notes
Review
See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.
Please review:
QA Checklist
Merge Checklist
While we perform many automated checks before auto-merging, some manual checks are needed: