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

[flutter_plugin_tools] Validate code blocks in readme-check #5436

Merged
merged 7 commits into from
Apr 29, 2022

Conversation

stuartmorgan-g
Copy link
Contributor

Updates readme-check to:

  • Require that a language annotation to be added to any code block.
  • Optionally require that any Dart (for now; we could eventually extend to other
    languages) code block use the code-excerpt.

Adds CI to validate that all packages are using code-excerpt, with a
temporary opt-out list for all of the packages with existing code blocks,
so that we can adopt it incrementally but prevent any new violations.

In order to land the language tag requirement, fixes a couple of blocks
that were missing the annotation.

No version change: The addition of a language block tag is too minor to be worth releasing.
No CHANGELOG change: The addition of a language block tag is too minor to be worth noting.

Part of flutter/flutter#102679

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.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Copy link
Member

@ditman ditman left a comment

Choose a reason for hiding this comment

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

I'm kinda excited about this. Not thrilled about the submodule, I wish the code-excerpter thing was a more proper "dependency".

Comment on lines +363 to +366
<?code-excerpt "main.dart (SomeSection)"?>
```dart
A B C
```
Copy link
Member

Choose a reason for hiding this comment

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

Is this what the output of the file will look like after running code-excerpt? Adding the code block below the code-excerpt tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, you put it above a code block (which can be empty to start) and the script will fill it with the extracted code. You can take a look at the camera README for a real example.

Copy link
Member

@ditman ditman Apr 29, 2022

Choose a reason for hiding this comment

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

I think I've seen it in the Flutter docs site, and it was not super evident how to update the .md snippets (or that the snippets were linked to actual code somewhere else).

I think I ended up doing a find and replace first, then learning about a script being available somewhere, and eventually managing to run it a while later; here are David's Misadventures With Code-Excerpt As A Complete Noob:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stuartmorgan-g
Copy link
Contributor Author

Not thrilled about the submodule

I hear you; my last experience with submodules (which granted was a while ago) was decidedly not great. But since this is firewalled off to just this script, I'm hoping it'll be pretty painless.

@stuartmorgan-g stuartmorgan-g 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 29, 2022
@fluttergithubbot fluttergithubbot merged commit f689280 into flutter:main Apr 29, 2022
@stuartmorgan-g stuartmorgan-g deleted the readme-require-excerpts branch April 29, 2022 02:31
CaseyHillers pushed a commit to flutter/flutter that referenced this pull request Apr 29, 2022
* c09ef582e [flutter_plugin_tools] Remove UWP (flutter/plugins#5432)

* 3876f54bf [ci.yaml] Remove explicit caches (flutter/plugins#5434)

* 0605d876d [webview_flutter_android] Updates `pigeon` version to support null safety (flutter/plugins#5395)

* 4b687c9fa [video_player] Fix XCUITest based on the new tooltip accessibility label (flutter/plugins#5426)

* e777e515b Roll Flutter from 1b58a59 to 4cea9af (147 revisions) (flutter/plugins#5437)

* 656e8c443 Roll Flutter from 4cea9af to 5b71314 (4 revisions) (flutter/plugins#5441)

* f689280bf [flutter_plugin_tools] Validate code blocks in readme-check (flutter/plugins#5436)

* 9c41c6895 Roll Flutter from 5b71314 to 7a74222 (1 revision) (flutter/plugins#5442)

* 160c714e7 Roll Flutter from 7a74222 to 2eed8cb (1 revision) (flutter/plugins#5443)
egramond pushed a commit to egramond/flutter that referenced this pull request May 5, 2022
…#102824)

* c09ef582e [flutter_plugin_tools] Remove UWP (flutter/plugins#5432)

* 3876f54bf [ci.yaml] Remove explicit caches (flutter/plugins#5434)

* 0605d876d [webview_flutter_android] Updates `pigeon` version to support null safety (flutter/plugins#5395)

* 4b687c9fa [video_player] Fix XCUITest based on the new tooltip accessibility label (flutter/plugins#5426)

* e777e515b Roll Flutter from 1b58a59 to 4cea9af (147 revisions) (flutter/plugins#5437)

* 656e8c443 Roll Flutter from 4cea9af to 5b71314 (4 revisions) (flutter/plugins#5441)

* f689280bf [flutter_plugin_tools] Validate code blocks in readme-check (flutter/plugins#5436)

* 9c41c6895 Roll Flutter from 5b71314 to 7a74222 (1 revision) (flutter/plugins#5442)

* 160c714e7 Roll Flutter from 7a74222 to 2eed8cb (1 revision) (flutter/plugins#5443)
mauricioluz pushed a commit to mauricioluz/plugins that referenced this pull request Jan 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants