-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[pigeon] Implement Screaming Snake Case Conversion for Kotlin Enum Cases #5918
[pigeon] Implement Screaming Snake Case Conversion for Kotlin Enum Cases #5918
Conversation
…n for enum member names to follow Kotlin naming conventions test(kotlin_generator_test.dart): update test cases to reflect changes in enum member name conversion
…ools.dart and pubspec.yaml to reflect new changes docs(pigeon): update CHANGELOG.md with details of the new version and migration note for users
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.
I think this is a good change, it will need updated integration tests as well though.
Thanks for putting this together.
…or enum class generation
…dd SnakeCase enum member to EnumState refactor(kotlin_generator.dart): simplify nameScreamingSnakeCase regex replacement logic test(EnumTest.kt): update test cases to use new SnakeCase enum member for better coverage
…edTwentyTwo' to AnEnum for extended test coverage
This shouldn't be passing tests as is, I'll go ahead and generate the new files, format them, and upload them to this pr (assuming the branch isn't preventing that). @stuartmorgan for tests not failing here. |
I was hesitant regarding the generated files, wanted to check if they would be generated when running the tests here on the CI, as I saw the generated files on my end had lots of changes but only regarding the formatting + a couple of new things regarding the additions |
always good to run the formatting tool after generation to clean things up a bit: https://github.com/flutter/plugins/blob/master_archive/script/tool/README.md#format-code |
There should also be a few integration test in |
…undredTwentyTwo' to AnEnum to extend test coverage
…n AnEnum for better code readability and to follow correct English spelling conventions
@stuartmorgan for second review |
cda5799
to
679cc3d
Compare
Sorry for the force push, I accidentally sent up a file I didn't mean to, had to revert that. |
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.
As long as the tests pass, this lgtm
What tests weren't failing that should have been, specifically? There was a Flutter-wide issue where test failures didn't turn the step red, so we can inspect the output manually. |
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.
LGTM
(Holding off on autosubmit until the test question is resolved in case there's still something going on here that would result in us not seeing issues with this PR in CI.) |
wasn't related to the code itself. There was no updated generated files, but it didn't fail the formatting test. |
flutter/packages@29d8cc0...11152d2 2024-02-09 [email protected] [webview_flutter] Add interface for showing javascript dialog message (flutter/packages#4704) 2024-02-09 [email protected] [pigeon] Implement Screaming Snake Case Conversion for Kotlin Enum Cases (flutter/packages#5918) 2024-02-09 [email protected] [camerax] Small fixes to starting/stopping video capture (flutter/packages#6068) 2024-02-08 [email protected] Roll Flutter from 8431cae to eb5d0a4 (33 revisions) (flutter/packages#6079) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…ses (flutter#5918) This pull request addresses issue flutter/flutter#140938 in the Pigeon package, related to the naming convention of Kotlin enum cases generated from lower camel case Dart enums. The current implementation concatenates the enum cases in uppercase, deviating from the Kotlin naming convention, specifically when dealing with multi-word names. Changes - Kotlin Enum Generation: Modified the writeEnum function in the Pigeon package to ensure the Kotlin generator produces enum cases in SCREAMING_SNAKE_CASE. This adheres to the Kotlin coding conventions and allows a consistent cross-platform enum naming convention across Dart, Kotlin, and Swift. - Regex Handling: Enhanced the regex pattern to correctly transform lower camel case names to screaming snake case, considering edge cases involving numbers and special characters. - Testing: Updated the Dart unit tests to include cases for validating the correct transformation of multi-word and complex enum names from lower camel case to screaming snake case.
This pull request addresses issue flutter/flutter#140938 in the Pigeon package, related to the naming convention of Kotlin enum cases generated from lower camel case Dart enums. The current implementation concatenates the enum cases in uppercase, deviating from the Kotlin naming convention, specifically when dealing with multi-word names.
Changes
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.