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.
This commit is contained in:
Kishan Dhankecha 2024-05-01 20:14:27 +05:30 committed by GitHub
parent cb2197e9b3
commit 2867ac7885
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 58 additions and 58 deletions

View File

@ -4,7 +4,7 @@
To run the scrolling benchmark on a device: To run the scrolling benchmark on a device:
``` ```sh
flutter drive --profile test_driver/scroll_perf.dart 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: To measure startup time on a device:
``` ```sh
flutter run --profile --trace-startup flutter run --profile --trace-startup
``` ```

View File

@ -8,7 +8,7 @@ Performance benchmarks use either flutter drive or the web benchmark harness.
To run the cull opacity benchmark on a device: 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 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: 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 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 the backdrop filter benchmark on a device:
To run a mobile 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 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: These tests should be run by:
```bash ```sh
flutter drive --profile -t test/[test_name]_e2e.dart --driver test_driver/e2e_test.dart 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: Example:
``` ```sh
cd dev/benchmarks/macrobenchmarks cd dev/benchmarks/macrobenchmarks
# Runs in profile mode using the HTML renderer # 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: You can also run all benchmarks exactly as the devicelab runs them:
``` ```sh
cd dev/devicelab cd dev/devicelab
# Runs using the HTML renderer # Runs using the HTML renderer

View File

@ -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 window to see the device logs, then, in a different window, run any of
these: these:
``` ```sh
flutter run --release lib/gestures/velocity_tracker_bench.dart flutter run --release lib/gestures/velocity_tracker_bench.dart
flutter run --release lib/gestures/gesture_detector_bench.dart flutter run --release lib/gestures/gesture_detector_bench.dart
flutter run --release lib/stocks/animation_bench.dart flutter run --release lib/stocks/animation_bench.dart

View File

@ -4,7 +4,7 @@
To run the scrolling benchmark on a device: To run the scrolling benchmark on a device:
``` ```sh
flutter drive --profile test_driver/scroll_perf.dart 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: To measure startup time on a device:
``` ```sh
flutter run --profile --trace-startup flutter run --profile --trace-startup
``` ```

View File

@ -4,7 +4,7 @@
To run the scrolling benchmark on a device: To run the scrolling benchmark on a device:
``` ```sh
flutter drive --profile test_driver/scroll_perf.dart 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: To measure startup time on a device:
``` ```sh
flutter run --profile --trace-startup flutter run --profile --trace-startup
``` ```

View File

@ -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 `d444a455de87a2e40b7f576dc12ffd9ab82fd491`, first do a dry run of the script to
see what it will do: see what it will do:
``` ```sh
$ dart ./unpublish_package.dart --temp_dir=/tmp/foo --revision d444a455de87a2e40b7f576dc12ffd9ab82fd491 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 And once you've verified the output of the dry run to be sure it is what you
want to do, run: want to do, run:
``` ```sh
$ dart ./unpublish_package.dart --confirm --temp_dir=/tmp/foo --revision d444a455de87a2e40b7f576dc12ffd9ab82fd491 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 and it will perform the actions. You will of course need to have access

View File

@ -35,7 +35,7 @@ All available commands can be seen via:
Releases are initialized with the `start` sub-command, like: Releases are initialized with the `start` sub-command, like:
``` ```sh
conductor start \ conductor start \
--candidate-branch=flutter-2.2-candidate.10 \ --candidate-branch=flutter-2.2-candidate.10 \
--release-channel=beta \ --release-channel=beta \

View File

@ -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 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: can use this command from the appropriate subdirectory:
```shell ```sh
flutter drive -t <test> --driver <driver> flutter drive -t <test> --driver <driver>
``` ```

View File

@ -1,7 +1,7 @@
# Android custom host app # Android custom host app
Android host app for a Flutter module created using Android host app for a Flutter module created using
``` ```sh
$ flutter create -t module hello $ flutter create -t module hello
``` ```
and placed in a sibling folder to (a clone of) the host app. and placed in a sibling folder to (a clone of) the host app.

View File

@ -1,7 +1,7 @@
# Android host app # Android host app
Android host app for a Flutter module created using Android host app for a Flutter module created using
``` ```sh
$ flutter create -t module hello $ flutter create -t module hello
``` ```
and placed in a sibling folder to (a clone of) the host app. and placed in a sibling folder to (a clone of) the host app.

View File

@ -28,7 +28,7 @@ subtle translation issues.
To run the test cases locally, use `flutter drive`[^2]: 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 flutter drive lib/frame_rate_main.dart --driver test_driver/frame_rate_test.dart
``` ```

View File

@ -3,7 +3,7 @@
Used by the `module_test_ios.dart` device lab test. Used by the `module_test_ios.dart` device lab test.
iOS host app for a Flutter module created using iOS host app for a Flutter module created using
``` ```sh
$ flutter create -t module hello $ flutter create -t module hello
``` ```
and placed in a sibling folder to (a clone of) the host app. and placed in a sibling folder to (a clone of) the host app.

View File

@ -1,7 +1,7 @@
# Android host app # Android host app
Android host app for a Flutter module created using Android host app for a Flutter module created using
``` ```sh
$ flutter create -t module hello $ flutter create -t module hello
``` ```
and placed in a sibling folder to (a clone of) the host app. and placed in a sibling folder to (a clone of) the host app.

View File

@ -6,7 +6,7 @@ chrome://version.
Start `chromedriver` using the following command: Start `chromedriver` using the following command:
``` ```sh
chromedriver --port=4444 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: Here's an example of running an integration test:
``` ```sh
flutter drive --target=test_driver/text_editing_integration.dart \ flutter drive --target=test_driver/text_editing_integration.dart \
-d web-server \ -d web-server \
--browser-name=chrome \ --browser-name=chrome \

View File

@ -4,7 +4,7 @@ Script that generates component theme data defaults based on token data.
## Usage ## Usage
Run this program from the root of the git repository: Run this program from the root of the git repository:
``` ```sh
dart dev/tools/gen_defaults/bin/gen_defaults.dart [-v] dart dev/tools/gen_defaults/bin/gen_defaults.dart [-v]
``` ```

View File

@ -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: The tool can be run based on the existing database. To do this, run:
```bash ```sh
/PATH/TO/ROOT/bin/gen_keycodes /PATH/TO/ROOT/bin/gen_keycodes
``` ```
The tool can also be run by rebuilding the database by drawing online information The tool can also be run by rebuilding the database by drawing online information
anew before generating the files. To do this, run: anew before generating the files. To do this, run:
```bash ```sh
/PATH/TO/ROOT/bin/gen_keycodes --collect /PATH/TO/ROOT/bin/gen_keycodes --collect
``` ```

View File

@ -1,8 +1,8 @@
## To run the Hello World demo: ## To run the Hello World demo:
``` ```sh
flutter run flutter run
``` ```
## To run the Hello World demo showing Arabic: ## To run the Hello World demo showing Arabic:
``` ```sh
flutter run lib/arabic.dart flutter run lib/arabic.dart
``` ```

View File

@ -21,7 +21,7 @@ Flutter's layered architecture.
To run each example, specify the demo file on the `flutter run` To run each example, specify the demo file on the `flutter run`
command line, for example: command line, for example:
``` ```sh
flutter run raw/spinning_square.dart flutter run raw/spinning_square.dart
flutter run rendering/spinning_square.dart flutter run rendering/spinning_square.dart
flutter run widgets/spinning_square.dart flutter run widgets/spinning_square.dart

View File

@ -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 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`: `pod install` needs to be invoked in the `ios/` folder before `flutter run`:
``` ```sh
pushd ios/ ; pod install ; popd pushd ios/ ; pod install ; popd
flutter run flutter run
``` ```

View File

@ -15,7 +15,7 @@ private interface can be accessed by the test.
The tests are run like so: The tests are run like so:
```shell ```sh
dart run bin/test_private.dart dart run bin/test_private.dart
``` ```

View File

@ -4,7 +4,7 @@
The `flutter` command-line tool supports a daemon server mode for use by IDEs and other tools. The `flutter` command-line tool supports a daemon server mode for use by IDEs and other tools.
``` ```sh
flutter daemon 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: 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}] [{"method":"daemon.version","id":0}]
``` ```
The response will come back as a single line from stdout: The response will come back as a single line from stdout:
``` ```json
[{"id":0,"result":"0.1.0"}] [{"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: 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}] [{"method":"device.getDevices","id":2}]
``` ```
``` ```json
[{"id":2,"result":[{"id":"702ABC1F-5EA5-4F83-84AB-6380CA91D39A","name":"iPhone 6","platform":"ios_x64","available":true}]}] [{"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. 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"}}] [{"event":"device.added","params":{"id":"1DD6786B-37D4-4355-AA15-B818A87A18B4","name":"iPhone XS Max","platform":"ios","emulator":true,"ephemeral":false,"platformType":"ios","category":"mobile"}}]
``` ```

View File

@ -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). `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" "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). `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" "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. 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", "type": "event",
"event": "flutter.serviceExtensionStateChanged", "event": "flutter.serviceExtensionStateChanged",

View File

@ -85,7 +85,7 @@ class GitHubTemplateCreator {
final String title = '[tool_crash] $errorString'; final String title = '[tool_crash] $errorString';
final String body = ''' final String body = '''
## Command ## Command
``` ```sh
$command $command
``` ```
@ -96,10 +96,10 @@ $command
## Logs ## Logs
$errorString $errorString
``` ```console
${LineSplitter.split(stackTrace.toString()).take(25).join('\n')} ${LineSplitter.split(stackTrace.toString()).take(25).join('\n')}
``` ```
``` ```console
$doctorText $doctorText
``` ```

View File

@ -165,10 +165,10 @@ void main() {
expect( expect(
await creator.toolCrashIssueTemplateGitHubURL(command, error, stackTrace, doctorText), await creator.toolCrashIssueTemplateGitHubURL(command, error, stackTrace, doctorText),
'https://github.com/flutter/flutter/issues/new?title=%5Btool_crash%5D+ArgumentError%3A+' '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' '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' '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' 'eport%0A%60%60%60%0A%0A%23%23+Flutter+Application+Metadata%0ANo+pubspec+in+working+d'
'irectory.%0A&labels=tool%2Csevere%3A+crash' 'irectory.%0A&labels=tool%2Csevere%3A+crash'
); );
@ -222,7 +222,7 @@ project_type: app
final String? actualBody = Uri.parse(actualURL).queryParameters['body']; final String? actualBody = Uri.parse(actualURL).queryParameters['body'];
const String expectedBody = ''' const String expectedBody = '''
## Command ## Command
``` ```sh
flutter test flutter test
``` ```
@ -233,10 +233,10 @@ flutter test
## Logs ## Logs
ArgumentError: Invalid argument(s): argument error message ArgumentError: Invalid argument(s): argument error message
``` ```console
trace trace
``` ```
``` ```console
[] Flutter (Channel report [] Flutter (Channel report
``` ```

View File

@ -6,7 +6,7 @@ Dart VM and Flutter integration.
Use this command to run (from the `flutter_tools` directory): Use this command to run (from the `flutter_tools` directory):
```shell ```sh
../../bin/cache/dart-sdk/bin/dart run test test/integration.shard ../../bin/cache/dart-sdk/bin/dart run test test/integration.shard
``` ```

View File

@ -6,7 +6,7 @@ Dart web debug services (dwds) and Flutter integration.
Use this command to run (from the `flutter_tools` directory): Use this command to run (from the `flutter_tools` directory):
```shell ```sh
../../bin/cache/dart-sdk/bin/dart run test test/web.shard ../../bin/cache/dart-sdk/bin/dart run test test/web.shard
``` ```

View File

@ -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: Your package should have a structure that looks like this:
``` ```text
lib/ lib/
... ...
integration_test/ integration_test/
@ -224,7 +224,7 @@ physical):
Note: Note:
To use `--dart-define` with `gradlew` you must `base64` encode all parameters, To use `--dart-define` with `gradlew` you must `base64` encode all parameters,
and pass them to gradle in a comma separated list: and pass them to gradle in a comma separated list:
```bash ```sh
./gradlew project:task -Pdart-defines="{base64(key=value)},[...]" ./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 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. instrumentation test for Android, after creating `androidTest` as suggested in the last section.
```bash ```sh
pushd android pushd android
# flutter build generates files in android/ for building the app # flutter build generates files in android/ for building the app
flutter build apk flutter build apk
@ -250,7 +250,7 @@ popd
Upload the build apks Firebase Test Lab, making sure to replace <PATH_TO_KEY_FILE>, Upload the build apks Firebase Test Lab, making sure to replace <PATH_TO_KEY_FILE>,
<PROJECT_NAME>, <RESULTS_BUCKET>, and <RESULTS_DIRECTORY> with your values. <PROJECT_NAME>, <RESULTS_BUCKET>, and <RESULTS_DIRECTORY> with your values.
```bash ```sh
gcloud auth activate-service-account --key-file=<PATH_TO_KEY_FILE> gcloud auth activate-service-account --key-file=<PATH_TO_KEY_FILE>
gcloud --quiet config set project <PROJECT_NAME> gcloud --quiet config set project <PROJECT_NAME>
gcloud firebase test android run --type instrumentation \ gcloud firebase test android run --type instrumentation \

View File

@ -17,7 +17,7 @@ flutter drive \
In one shell, run Chromedriver ([download In one shell, run Chromedriver ([download
here](https://chromedriver.chromium.org/downloads)): here](https://chromedriver.chromium.org/downloads)):
``` ```sh
chromedriver --port 8444 chromedriver --port 8444
``` ```