From 2867ac78852962501a7069582eeea5916fc5dc2e Mon Sep 17 00:00:00 2001 From: Kishan Dhankecha Date: Wed, 1 May 2024 20:14:27 +0530 Subject: [PATCH] Added missing code block language in docs (#147481) - added language for all code blocks - replaced `bash` or `shell` with `sh` for consistency. - added `sh` and `console` in the GitHub template link generator. - updated test for GitHub template. --- dev/benchmarks/complex_layout/README.md | 4 ++-- dev/benchmarks/macrobenchmarks/README.md | 12 ++++++------ dev/benchmarks/microbenchmarks/README.md | 2 +- dev/benchmarks/platform_views_layout/README.md | 4 ++-- .../README.md | 4 ++-- dev/bots/README.md | 8 ++++---- dev/conductor/README.md | 2 +- dev/integration_tests/README.md | 2 +- .../android_custom_host_app/README.md | 2 +- .../android_host_app_v2_embedding/README.md | 2 +- dev/integration_tests/external_textures/README.md | 2 +- dev/integration_tests/ios_host_app/README.md | 2 +- .../README.md | 2 +- dev/integration_tests/web_e2e_tests/README.md | 4 ++-- dev/tools/gen_defaults/README.md | 2 +- dev/tools/gen_keycodes/README.md | 4 ++-- examples/hello_world/README.md | 4 ++-- examples/layers/README.md | 2 +- examples/platform_view/README.md | 2 +- packages/flutter/test_private/README.md | 2 +- packages/flutter_tools/doc/daemon.md | 12 ++++++------ .../flutter_tools/lib/src/debug_adapters/README.md | 6 +++--- .../lib/src/reporting/github_template.dart | 6 +++--- .../test/general.shard/github_template_test.dart | 10 +++++----- .../flutter_tools/test/integration.shard/README.md | 2 +- packages/flutter_tools/test/web.shard/README.md | 2 +- packages/integration_test/README.md | 8 ++++---- packages/integration_test/example/README.md | 2 +- 28 files changed, 58 insertions(+), 58 deletions(-) diff --git a/dev/benchmarks/complex_layout/README.md b/dev/benchmarks/complex_layout/README.md index f50b854e4c..d05489a8cb 100644 --- a/dev/benchmarks/complex_layout/README.md +++ b/dev/benchmarks/complex_layout/README.md @@ -4,7 +4,7 @@ To run the scrolling benchmark on a device: -``` +```sh flutter drive --profile test_driver/scroll_perf.dart ``` @@ -17,7 +17,7 @@ More detailed logs should be in `build/complex_layout_scroll_perf.timeline.json` To measure startup time on a device: -``` +```sh flutter run --profile --trace-startup ``` diff --git a/dev/benchmarks/macrobenchmarks/README.md b/dev/benchmarks/macrobenchmarks/README.md index cd947ca437..2f2dce6ce6 100644 --- a/dev/benchmarks/macrobenchmarks/README.md +++ b/dev/benchmarks/macrobenchmarks/README.md @@ -8,7 +8,7 @@ Performance benchmarks use either flutter drive or the web benchmark harness. To run the cull opacity benchmark on a device: -``` +```sh flutter drive --profile -t test_driver/run_app.dart --driver test_driver/cull_opacity_perf_test.dart ``` @@ -20,7 +20,7 @@ More detailed logs should be in `build/cull_opacity_perf.timeline.json`. To run the cubic-bezier benchmark on a device: -``` +```sh flutter drive --profile -t test_driver/run_app.dart --driver test_driver/cubic_bezier_perf_test.dart ``` @@ -33,7 +33,7 @@ More detailed logs should be in `build/cubic_bezier_perf.timeline.json`. To run the backdrop filter benchmark on a device: To run a mobile benchmark on a device: -```bash +```sh flutter drive --profile -t test_driver/run_app.dart --driver test_driver/[test_name]_test.dart ``` @@ -69,7 +69,7 @@ host machine. The following tests are E2E: These tests should be run by: -```bash +```sh flutter drive --profile -t test/[test_name]_e2e.dart --driver test_driver/e2e_test.dart ``` @@ -118,7 +118,7 @@ and the profile contains unobfuscated names. Example: -``` +```sh cd dev/benchmarks/macrobenchmarks # Runs in profile mode using the HTML renderer @@ -130,7 +130,7 @@ flutter run --web-renderer=canvaskit --profile -d web-server lib/web_benchmarks. You can also run all benchmarks exactly as the devicelab runs them: -``` +```sh cd dev/devicelab # Runs using the HTML renderer diff --git a/dev/benchmarks/microbenchmarks/README.md b/dev/benchmarks/microbenchmarks/README.md index 42e45c1427..157869ad10 100644 --- a/dev/benchmarks/microbenchmarks/README.md +++ b/dev/benchmarks/microbenchmarks/README.md @@ -4,7 +4,7 @@ To run these benchmarks on a device, first run `flutter logs' in one window to see the device logs, then, in a different window, run any of these: -``` +```sh flutter run --release lib/gestures/velocity_tracker_bench.dart flutter run --release lib/gestures/gesture_detector_bench.dart flutter run --release lib/stocks/animation_bench.dart diff --git a/dev/benchmarks/platform_views_layout/README.md b/dev/benchmarks/platform_views_layout/README.md index a2f3a19178..eef27e8528 100644 --- a/dev/benchmarks/platform_views_layout/README.md +++ b/dev/benchmarks/platform_views_layout/README.md @@ -4,7 +4,7 @@ To run the scrolling benchmark on a device: -``` +```sh flutter drive --profile test_driver/scroll_perf.dart ``` @@ -17,7 +17,7 @@ More detailed logs should be in `build/platform_views_scroll_perf.timeline.json` To measure startup time on a device: -``` +```sh flutter run --profile --trace-startup ``` diff --git a/dev/benchmarks/platform_views_layout_hybrid_composition/README.md b/dev/benchmarks/platform_views_layout_hybrid_composition/README.md index cb35ed6efd..727fd58cbe 100644 --- a/dev/benchmarks/platform_views_layout_hybrid_composition/README.md +++ b/dev/benchmarks/platform_views_layout_hybrid_composition/README.md @@ -4,7 +4,7 @@ To run the scrolling benchmark on a device: -``` +```sh flutter drive --profile test_driver/scroll_perf.dart ``` @@ -17,7 +17,7 @@ More detailed logs should be in `build/platform_views_scroll_perf_hybrid_composi To measure startup time on a device: -``` +```sh flutter run --profile --trace-startup ``` diff --git a/dev/bots/README.md b/dev/bots/README.md index 4d6203edad..daf4aeef35 100644 --- a/dev/bots/README.md +++ b/dev/bots/README.md @@ -165,15 +165,15 @@ For example To remove a published package corresponding to the git hash `d444a455de87a2e40b7f576dc12ffd9ab82fd491`, first do a dry run of the script to see what it will do: -``` -$ dart ./unpublish_package.dart --temp_dir=/tmp/foo --revision d444a455de87a2e40b7f576dc12ffd9ab82fd491 +```sh +dart ./unpublish_package.dart --temp_dir=/tmp/foo --revision d444a455de87a2e40b7f576dc12ffd9ab82fd491 ``` And once you've verified the output of the dry run to be sure it is what you want to do, run: -``` -$ dart ./unpublish_package.dart --confirm --temp_dir=/tmp/foo --revision d444a455de87a2e40b7f576dc12ffd9ab82fd491 +```sh +dart ./unpublish_package.dart --confirm --temp_dir=/tmp/foo --revision d444a455de87a2e40b7f576dc12ffd9ab82fd491 ``` and it will perform the actions. You will of course need to have access diff --git a/dev/conductor/README.md b/dev/conductor/README.md index 8899226c38..e7b6682096 100644 --- a/dev/conductor/README.md +++ b/dev/conductor/README.md @@ -35,7 +35,7 @@ All available commands can be seen via: Releases are initialized with the `start` sub-command, like: -``` +```sh conductor start \ --candidate-branch=flutter-2.2-candidate.10 \ --release-channel=beta \ diff --git a/dev/integration_tests/README.md b/dev/integration_tests/README.md index 4be32c8212..d3fa7808ed 100644 --- a/dev/integration_tests/README.md +++ b/dev/integration_tests/README.md @@ -9,7 +9,7 @@ Intended for use with devicelab tests. If you want to run a driver test locally, to debug a problem with a test, you can use this command from the appropriate subdirectory: -```shell +```sh flutter drive -t --driver ``` diff --git a/dev/integration_tests/android_custom_host_app/README.md b/dev/integration_tests/android_custom_host_app/README.md index 7547c878e5..ac6220f729 100644 --- a/dev/integration_tests/android_custom_host_app/README.md +++ b/dev/integration_tests/android_custom_host_app/README.md @@ -1,7 +1,7 @@ # Android custom host app Android host app for a Flutter module created using -``` +```sh $ flutter create -t module hello ``` and placed in a sibling folder to (a clone of) the host app. diff --git a/dev/integration_tests/android_host_app_v2_embedding/README.md b/dev/integration_tests/android_host_app_v2_embedding/README.md index 1523329f41..8c8ad260dc 100644 --- a/dev/integration_tests/android_host_app_v2_embedding/README.md +++ b/dev/integration_tests/android_host_app_v2_embedding/README.md @@ -1,7 +1,7 @@ # Android host app Android host app for a Flutter module created using -``` +```sh $ flutter create -t module hello ``` and placed in a sibling folder to (a clone of) the host app. diff --git a/dev/integration_tests/external_textures/README.md b/dev/integration_tests/external_textures/README.md index 3e0f1eec37..80f7c09234 100644 --- a/dev/integration_tests/external_textures/README.md +++ b/dev/integration_tests/external_textures/README.md @@ -28,7 +28,7 @@ subtle translation issues. To run the test cases locally, use `flutter drive`[^2]: -```shell +```sh flutter drive lib/frame_rate_main.dart --driver test_driver/frame_rate_test.dart ``` diff --git a/dev/integration_tests/ios_host_app/README.md b/dev/integration_tests/ios_host_app/README.md index 75843e8e20..6a8408d26e 100644 --- a/dev/integration_tests/ios_host_app/README.md +++ b/dev/integration_tests/ios_host_app/README.md @@ -3,7 +3,7 @@ Used by the `module_test_ios.dart` device lab test. iOS host app for a Flutter module created using -``` +```sh $ flutter create -t module hello ``` and placed in a sibling folder to (a clone of) the host app. diff --git a/dev/integration_tests/module_host_with_custom_build_v2_embedding/README.md b/dev/integration_tests/module_host_with_custom_build_v2_embedding/README.md index 85b88745cd..ae5ffc13f5 100644 --- a/dev/integration_tests/module_host_with_custom_build_v2_embedding/README.md +++ b/dev/integration_tests/module_host_with_custom_build_v2_embedding/README.md @@ -1,7 +1,7 @@ # Android host app Android host app for a Flutter module created using -``` +```sh $ flutter create -t module hello ``` and placed in a sibling folder to (a clone of) the host app. diff --git a/dev/integration_tests/web_e2e_tests/README.md b/dev/integration_tests/web_e2e_tests/README.md index ca93161c11..15ba8faa74 100644 --- a/dev/integration_tests/web_e2e_tests/README.md +++ b/dev/integration_tests/web_e2e_tests/README.md @@ -6,7 +6,7 @@ chrome://version. Start `chromedriver` using the following command: -``` +```sh chromedriver --port=4444 ``` @@ -18,7 +18,7 @@ mode you'd like to run the test in. Here's an example of running an integration test: -``` +```sh flutter drive --target=test_driver/text_editing_integration.dart \ -d web-server \ --browser-name=chrome \ diff --git a/dev/tools/gen_defaults/README.md b/dev/tools/gen_defaults/README.md index 7990079f50..a849b96c5c 100644 --- a/dev/tools/gen_defaults/README.md +++ b/dev/tools/gen_defaults/README.md @@ -4,7 +4,7 @@ Script that generates component theme data defaults based on token data. ## Usage Run this program from the root of the git repository: -``` +```sh dart dev/tools/gen_defaults/bin/gen_defaults.dart [-v] ``` diff --git a/dev/tools/gen_keycodes/README.md b/dev/tools/gen_keycodes/README.md index 99811c0dab..8235e6161f 100644 --- a/dev/tools/gen_keycodes/README.md +++ b/dev/tools/gen_keycodes/README.md @@ -24,14 +24,14 @@ output files can be generated without the Internet. The tool can be run based on the existing database. To do this, run: -```bash +```sh /PATH/TO/ROOT/bin/gen_keycodes ``` The tool can also be run by rebuilding the database by drawing online information anew before generating the files. To do this, run: -```bash +```sh /PATH/TO/ROOT/bin/gen_keycodes --collect ``` diff --git a/examples/hello_world/README.md b/examples/hello_world/README.md index 0a9132c376..83789437ce 100644 --- a/examples/hello_world/README.md +++ b/examples/hello_world/README.md @@ -1,8 +1,8 @@ ## To run the Hello World demo: -``` +```sh flutter run ``` ## To run the Hello World demo showing Arabic: -``` +```sh flutter run lib/arabic.dart ``` diff --git a/examples/layers/README.md b/examples/layers/README.md index d888e5e260..c0044d138e 100644 --- a/examples/layers/README.md +++ b/examples/layers/README.md @@ -21,7 +21,7 @@ Flutter's layered architecture. To run each example, specify the demo file on the `flutter run` command line, for example: -``` +```sh flutter run raw/spinning_square.dart flutter run rendering/spinning_square.dart flutter run widgets/spinning_square.dart diff --git a/examples/platform_view/README.md b/examples/platform_view/README.md index c1a95888e1..5cd2126fd5 100644 --- a/examples/platform_view/README.md +++ b/examples/platform_view/README.md @@ -6,7 +6,7 @@ full-screen Flutter view along with passing data back and forth between the two. On iOS, we use a CocoaPods dependency to add a Material Design button, and so `pod install` needs to be invoked in the `ios/` folder before `flutter run`: -``` +```sh pushd ios/ ; pod install ; popd flutter run ``` diff --git a/packages/flutter/test_private/README.md b/packages/flutter/test_private/README.md index 1f551cf34b..7dee07089e 100644 --- a/packages/flutter/test_private/README.md +++ b/packages/flutter/test_private/README.md @@ -15,7 +15,7 @@ private interface can be accessed by the test. The tests are run like so: -```shell +```sh dart run bin/test_private.dart ``` diff --git a/packages/flutter_tools/doc/daemon.md b/packages/flutter_tools/doc/daemon.md index 9d6cabd954..5fc9d22273 100644 --- a/packages/flutter_tools/doc/daemon.md +++ b/packages/flutter_tools/doc/daemon.md @@ -4,7 +4,7 @@ The `flutter` command-line tool supports a daemon server mode for use by IDEs and other tools. -``` +```sh flutter daemon ``` @@ -16,13 +16,13 @@ A set of `flutter daemon` commands/events are also exposed via `flutter run --ma The daemon speaks [JSON-RPC](http://json-rpc.org/) to clients. It uses stdin and stdout as the transport protocol. To send a command to the server, create your command as a JSON-RPC message, encode it to JSON, surround the encoded text with square brackets, and write it as one line of text to the stdin of the process: -``` +```json [{"method":"daemon.version","id":0}] ``` The response will come back as a single line from stdout: -``` +```json [{"id":0,"result":"0.1.0"}] ``` @@ -34,17 +34,17 @@ Each command should have a `method` field. This is in the form '`domain.command` Any params for that command should be passed in through a `params` field. Here's an example request/response for the `device.getDevices` method: -``` +```json [{"method":"device.getDevices","id":2}] ``` -``` +```json [{"id":2,"result":[{"id":"702ABC1F-5EA5-4F83-84AB-6380CA91D39A","name":"iPhone 6","platform":"ios_x64","available":true}]}] ``` Events that come from the server will have an `event` field containing the type of event, along with a `params` field. -``` +```json [{"event":"device.added","params":{"id":"1DD6786B-37D4-4355-AA15-B818A87A18B4","name":"iPhone XS Max","platform":"ios","emulator":true,"ephemeral":false,"platformType":"ios","category":"mobile"}}] ``` diff --git a/packages/flutter_tools/lib/src/debug_adapters/README.md b/packages/flutter_tools/lib/src/debug_adapters/README.md index 917a714342..c1a14c40d4 100644 --- a/packages/flutter_tools/lib/src/debug_adapters/README.md +++ b/packages/flutter_tools/lib/src/debug_adapters/README.md @@ -53,7 +53,7 @@ Some custom requests are available for clients to call. Below are the Flutter-sp `hotReload` injects updated source code files into the running VM and then rebuilds the widget tree. An optional `reason` can be provided and should usually be `"manual"` or `"save"` to indicate what how the reload was triggered (for example by the user clicking a button, versus a hot-reload-on-save feature). -``` +```json { "reason": "manual" } @@ -63,7 +63,7 @@ Some custom requests are available for clients to call. Below are the Flutter-sp `hotRestart` updates the code on the device and performs a full restart (which does not preserve state). An optional `reason` can be provided and should usually be `"manual"` or `"save"` to indicate what how the reload was triggered (for example by the user clicking a button, versus a hot-reload-on-save feature). -``` +```json { "reason": "manual" } @@ -81,7 +81,7 @@ This event is emitted when the application has started up. Unlike `dart.debugger When the value of a Flutter service extension changes, this event is emitted and includes the new value. Values are always encoded as strings, even if numeric/boolean. -``` +```json { "type": "event", "event": "flutter.serviceExtensionStateChanged", diff --git a/packages/flutter_tools/lib/src/reporting/github_template.dart b/packages/flutter_tools/lib/src/reporting/github_template.dart index 5a61b7b5fb..604e56204a 100644 --- a/packages/flutter_tools/lib/src/reporting/github_template.dart +++ b/packages/flutter_tools/lib/src/reporting/github_template.dart @@ -85,7 +85,7 @@ class GitHubTemplateCreator { final String title = '[tool_crash] $errorString'; final String body = ''' ## Command -``` +```sh $command ``` @@ -96,10 +96,10 @@ $command ## Logs $errorString -``` +```console ${LineSplitter.split(stackTrace.toString()).take(25).join('\n')} ``` -``` +```console $doctorText ``` diff --git a/packages/flutter_tools/test/general.shard/github_template_test.dart b/packages/flutter_tools/test/general.shard/github_template_test.dart index 745bec9f15..60b173f825 100644 --- a/packages/flutter_tools/test/general.shard/github_template_test.dart +++ b/packages/flutter_tools/test/general.shard/github_template_test.dart @@ -165,10 +165,10 @@ void main() { expect( await creator.toolCrashIssueTemplateGitHubURL(command, error, stackTrace, doctorText), 'https://github.com/flutter/flutter/issues/new?title=%5Btool_crash%5D+ArgumentError%3A+' - 'Invalid+argument%28s%29%3A+argument+error+message&body=%23%23+Command%0A%60%60%60%0A' + 'Invalid+argument%28s%29%3A+argument+error+message&body=%23%23+Command%0A%60%60%60sh%0A' 'flutter+test%0A%60%60%60%0A%0A%23%23+Steps+to+Reproduce%0A1.+...%0A2.+...%0A3.+...%0' 'A%0A%23%23+Logs%0AArgumentError%3A+Invalid+argument%28s%29%3A+argument+error+message' - '%0A%60%60%60%0Atrace%0A%60%60%60%0A%60%60%60%0A+%5B%E2%9C%93%5D+Flutter+%28Channel+r' + '%0A%60%60%60console%0Atrace%0A%60%60%60%0A%60%60%60console%0A+%5B%E2%9C%93%5D+Flutter+%28Channel+r' 'eport%0A%60%60%60%0A%0A%23%23+Flutter+Application+Metadata%0ANo+pubspec+in+working+d' 'irectory.%0A&labels=tool%2Csevere%3A+crash' ); @@ -222,7 +222,7 @@ project_type: app final String? actualBody = Uri.parse(actualURL).queryParameters['body']; const String expectedBody = ''' ## Command -``` +```sh flutter test ``` @@ -233,10 +233,10 @@ flutter test ## Logs ArgumentError: Invalid argument(s): argument error message -``` +```console trace ``` -``` +```console [✓] Flutter (Channel report ``` diff --git a/packages/flutter_tools/test/integration.shard/README.md b/packages/flutter_tools/test/integration.shard/README.md index 94efcf48f7..19f7987428 100644 --- a/packages/flutter_tools/test/integration.shard/README.md +++ b/packages/flutter_tools/test/integration.shard/README.md @@ -6,7 +6,7 @@ Dart VM and Flutter integration. Use this command to run (from the `flutter_tools` directory): -```shell +```sh ../../bin/cache/dart-sdk/bin/dart run test test/integration.shard ``` diff --git a/packages/flutter_tools/test/web.shard/README.md b/packages/flutter_tools/test/web.shard/README.md index f477d3b707..4e41f7ce70 100644 --- a/packages/flutter_tools/test/web.shard/README.md +++ b/packages/flutter_tools/test/web.shard/README.md @@ -6,7 +6,7 @@ Dart web debug services (dwds) and Flutter integration. Use this command to run (from the `flutter_tools` directory): -```shell +```sh ../../bin/cache/dart-sdk/bin/dart run test test/web.shard ``` diff --git a/packages/integration_test/README.md b/packages/integration_test/README.md index 6ebec27291..a53f7e609d 100644 --- a/packages/integration_test/README.md +++ b/packages/integration_test/README.md @@ -56,7 +56,7 @@ See the [extended driver](https://github.com/flutter/flutter/blob/main/packages/ Your package should have a structure that looks like this: -``` +```text lib/ ... integration_test/ @@ -224,7 +224,7 @@ physical): Note: To use `--dart-define` with `gradlew` you must `base64` encode all parameters, and pass them to gradle in a comma separated list: -```bash +```sh ./gradlew project:task -Pdart-defines="{base64(key=value)},[...]" ``` @@ -238,7 +238,7 @@ to set up a project. To run a test on Android devices using Firebase Test Lab, use gradle commands to build an instrumentation test for Android, after creating `androidTest` as suggested in the last section. -```bash +```sh pushd android # flutter build generates files in android/ for building the app flutter build apk @@ -250,7 +250,7 @@ popd Upload the build apks Firebase Test Lab, making sure to replace , , , and with your values. -```bash +```sh gcloud auth activate-service-account --key-file= gcloud --quiet config set project gcloud firebase test android run --type instrumentation \ diff --git a/packages/integration_test/example/README.md b/packages/integration_test/example/README.md index 8b2c03573b..dbd45d3c63 100644 --- a/packages/integration_test/example/README.md +++ b/packages/integration_test/example/README.md @@ -17,7 +17,7 @@ flutter drive \ In one shell, run Chromedriver ([download here](https://chromedriver.chromium.org/downloads)): -``` +```sh chromedriver --port 8444 ```