[mustache_template] Add example app and code excerpts#11316
[mustache_template] Add example app and code excerpts#11316saudademjj wants to merge 3 commits intoflutter:mainfrom
Conversation
Create a runnable example app and readme_excerpts.dart with #docregion markers for all README code examples. Migrate inline README code blocks to the <?code-excerpt?> system for CI validation. Fixes flutter/flutter#183936
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Code Review
This pull request introduces a runnable example application for the mustache_template package and migrates all code examples from the README to the code-excerpt system for CI validation. This migration also includes modernizing the code style and fixing several errors in the original examples. My review focuses on ensuring consistency in the newly added code. I've suggested a couple of minor improvements in the new example app to align with modern Dart conventions and maintain consistency with the other changes in this PR.
|
Thanks for the contribution!
The documented exemption is for "unpublished parts of example apps";
Which of the documented exemption reasons is this referring to? |
|
|
||
| print(output); | ||
| } | ||
| // #enddocregion ExampleUsage |
There was a problem hiding this comment.
This is essentially identical to main.dart, so we should just extract from that file instead of having a near-exact copy of it.
| import '../example/lib/main.dart' as example_app; | ||
| import '../example/lib/readme_excerpts.dart' as readme_excerpts; | ||
|
|
||
| Future<List<String>> _capturePrints(FutureOr<void> Function() body) async { |
There was a problem hiding this comment.
The tests would be a lot more straightforward if the excerpt wrapper functions simply returned a string instead of printing, since that's not part of the excerpting anyway. Adding zones makes things much more complicated.
Sycophancy is not helpful in a code review. Having an AI generate text to tell me that I understand policies that I wrote serves no constructive purpose, it just wastes everyone's time.
Please explain how this comment came to be posted. I marking this PR as a draft pending some convincing explanation that this is not, as it very much appears to be, a violation of the policy you were explicitly pointed to less than a day ago. |
We have had many successful code reviews with people posting actual information in imperfect English. We have had zero with people posting fluent-sounding hallucinations, which is why we have a clear written policy banning it.
When I closed your previous PR I said that if you opened a new PR it would need to follow our AI contribution guidelines. When you opened this PR you explicitly indicated that you had read them and would follow them:
The time to start following the policy was when you agreed to do so the first time. Given that you have already chosen not to follow the policy after saying that you would, it seems clear that you don't understand that we take this seriously. Especially since you are still doing it. This statement:
As noted in the policy, we consider a pattern of violation to be a code of conduct violation, so I have administered a seven-day ban. If you plan to continue with this PR after that, please use that time to re-read the Code of Conduct, and the section of the AI contribution guidelines that explains why the guidelines exist. |
Adds a runnable example application and migrates all inline README code blocks to the
<?code-excerpt?>system for CI validation.example/lib/main.dartdemonstrating basic template rendering, nested paths, and lambdasexample/lib/readme_excerpts.dartwith#docregionmarkers for all 8 README code examplesvar->final/const, adds trailing commas, fixes syntax errors in original examplesmustache_templatefromtemp_exclude_excerpt.yamltest/example_test.dartto validate the example app output and all README excerpt examplesFixes flutter/flutter#183936
Validation:
dart analyzedart testdart run example/lib/main.dartdart run script/tool/bin/flutter_plugin_tools.dart update-excerpts --packages mustache_template --fail-on-changePre-Review Checklist
[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2