[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[flutter_plugin_tools] Adds update-excerpts command #5339

Merged
merged 20 commits into from
Apr 28, 2022

Conversation

stuartmorgan
Copy link
Contributor
@stuartmorgan stuartmorgan commented Apr 22, 2022

Adds a new update-excerpts command that uses code_excerpter and code_excerpt_updater to update README code snippets from actual source, which will avoid issues with README code becoming stale (not being updated for changes like NNBD, not reflecting changes to the package API), not following expected style (formatting, lint rules), or being flat out wrong (e.g., a typo that prevents compiling). Also includes a --fail-on-change flag like the autoformat command, so that CI can validate that source code and README targets stay synchronized.

Unlike the flutter/website use of these builders, they are configured per-package here to minimize the amount that someone has to learn about repository structure in order to write correct source file references, since they are entirely package-local.

  • Includes a conversion of camera's README code snippets as a proof of concept.
  • Does not include enforcement of using excerpts for code snippets, but that can be added as on option to readme-check in a follow-up.

Implements flutter/flutter#89987 for this repository; it can be rolled out to flutter/packages in a follow-up

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@stuartmorgan stuartmorgan marked this pull request as draft April 22, 2022 20:42
@stuartmorgan stuartmorgan marked this pull request as ready for review April 25, 2022 18:39
@stuartmorgan
Copy link
Contributor Author

@csells FYI 🙂

@csells
Copy link
Contributor
csells commented Apr 25, 2022

Nice!!

@stuartmorgan stuartmorgan changed the title [flutter_plugin_tools] Adds update-snippets command [flutter_plugin_tools] Adds update-excerpts command Apr 26, 2022
Copy link
Contributor
@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a couple nits and suggestions

script/tool/lib/src/license_check_command.dart Outdated Show resolved Hide resolved
script/tool/lib/src/update_snippets_command.dart Outdated Show resolved Hide resolved
script/tool/lib/src/update_snippets_command.dart Outdated Show resolved Hide resolved
script/tool/lib/src/update_snippets_command.dart Outdated Show resolved Hide resolved
script/tool/test/update_snippets_command_test.dart Outdated Show resolved Hide resolved
@stuartmorgan stuartmorgan added the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p: camera waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
4 participants