Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
358: Create code samples from code, a.k.a. code excerpts r=ahmednfwela a=ahmednfwela # Pull Request ## What does this PR do? This PR completely automates updating the code samples file [.code-samples.meilisearch.yaml](https://github.com/meilisearch/meilisearch-dart/blob/main/.code-samples.meilisearch.yaml) it creates a new PRIVATE `tool` that does 2 things 1. updates the sample file from source code (run by contributors) 2. check if the sample file is up to date with source code (run in CI) the private tool checks dart files in `lib/` and `test/` directory for lines that follow this pattern: ```dart // #docregion key anything() // #enddocregion ``` where `key` is a key in `.code-samples.meilisearch.yaml` [This run](https://github.com/meilisearch/meilisearch-dart/actions/runs/6259938891/job/16996958519?pr=358#step:4:158) shows CI fail in action, due to format mismatch for key `search_parameter_guide_show_ranking_score_1` between code file and yaml file. This commit f9109a0 shows how to fix the failed run, by running `dart run ./tool/bin/meili.dart update-samples` in the root directory of the repo. this should simplify adding samples, and avoid issues like #357 --- ## Update I have also added functionality to detect missing and useless keys, see this failing run for example: https://github.com/meilisearch/meilisearch-dart/actions/runs/6262599763/job/17005143489?pr=358#step:4:159 ## PR checklist WIP - [ ] remove unnecessary indentations from code. Please check if your PR fulfills the following requirements: - [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [x] Have you read the contributing guidelines? - [x] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! Co-authored-by: Ahmed Fwela <ahmednfwela@bdaya-dev.com> Co-authored-by: Ahmed Fwela <63286031+ahmednfwela@users.noreply.github.com>
- Loading branch information