Document why some lints aren't enabled and fix some minor issues. (#91527)
This commit is contained in:
5
packages/flutter/lib/analysis_options.yaml
Normal file
5
packages/flutter/lib/analysis_options.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
include: ../analysis_options.yaml
|
||||
|
||||
linter:
|
||||
rules:
|
||||
# - diagnostic_describe_all_properties # blocked on https://github.com/dart-lang/sdk/issues/47418
|
||||
@@ -556,53 +556,55 @@ abstract class FlutterDriver {
|
||||
///
|
||||
/// The image will be returned as a PNG.
|
||||
///
|
||||
/// HACK: There will be a 2-second artificial delay before screenshotting,
|
||||
/// the delay here is to deal with a race between the driver script and
|
||||
/// the raster thread (formerly known as the GPU thread). The issue is
|
||||
/// that driver API synchronizes with the framework based on transient
|
||||
/// callbacks, which are out of sync with the raster thread.
|
||||
/// Here's the timeline of events in ASCII art:
|
||||
/// **Warning:** This is not reliable.
|
||||
///
|
||||
/// -------------------------------------------------------------------
|
||||
/// Without this delay:
|
||||
/// -------------------------------------------------------------------
|
||||
/// UI : <-- build -->
|
||||
/// Raster: <-- rasterize -->
|
||||
/// Gap : | random |
|
||||
/// Driver: <-- screenshot -->
|
||||
/// There is a two-second artificial delay before screenshotting. The delay
|
||||
/// here is to deal with a race between the driver script and the raster
|
||||
/// thread (formerly known as the GPU thread). The issue is that the driver
|
||||
/// API synchronizes with the framework based on transient callbacks, which
|
||||
/// are out of sync with the raster thread.
|
||||
///
|
||||
/// In the diagram above, the gap is the time between the last driver
|
||||
/// action taken, such as a `tap()`, and the subsequent call to
|
||||
/// `screenshot()`. The gap is random because it is determined by the
|
||||
/// unpredictable network communication between the driver process and
|
||||
/// the application. If this gap is too short, which it typically will
|
||||
/// be, the screenshot is taken before the raster thread is done
|
||||
/// rasterizing the frame, so the screenshot of the previous frame is
|
||||
/// taken, which is wrong.
|
||||
/// Here's the timeline of events in ASCII art:
|
||||
///
|
||||
/// -------------------------------------------------------------------
|
||||
/// With this delay, if we're lucky:
|
||||
/// -------------------------------------------------------------------
|
||||
/// UI : <-- build -->
|
||||
/// Raster: <-- rasterize -->
|
||||
/// Gap : | 2 seconds or more |
|
||||
/// Driver: <-- screenshot -->
|
||||
/// ---------------------------------------------------------------
|
||||
/// Without this delay:
|
||||
/// ---------------------------------------------------------------
|
||||
/// UI : <-- build -->
|
||||
/// Raster: <-- rasterize -->
|
||||
/// Gap : | random |
|
||||
/// Driver: <-- screenshot -->
|
||||
///
|
||||
/// The two-second gap should be long enough for the raster thread to
|
||||
/// finish rasterizing the frame, but not longer than necessary to keep
|
||||
/// driver tests as fast a possible.
|
||||
/// In the diagram above, the gap is the time between the last driver action
|
||||
/// taken, such as a `tap()`, and the subsequent call to `screenshot()`. The
|
||||
/// gap is random because it is determined by the unpredictable communication
|
||||
/// channel between the driver process and the application. If this gap is too
|
||||
/// short, which it typically will be, the screenshot is taken before the
|
||||
/// raster thread is done rasterizing the frame, so the screenshot of the
|
||||
/// previous frame is taken, which is not what is intended.
|
||||
///
|
||||
/// -------------------------------------------------------------------
|
||||
/// With this delay, if we're not lucky:
|
||||
/// -------------------------------------------------------------------
|
||||
/// UI : <-- build -->
|
||||
/// Raster: <-- rasterize randomly slow today -->
|
||||
/// Gap : | 2 seconds or more |
|
||||
/// Driver: <-- screenshot -->
|
||||
/// ---------------------------------------------------------------
|
||||
/// With this delay, if we're lucky:
|
||||
/// ---------------------------------------------------------------
|
||||
/// UI : <-- build -->
|
||||
/// Raster: <-- rasterize -->
|
||||
/// Gap : | 2 seconds or more |
|
||||
/// Driver: <-- screenshot -->
|
||||
///
|
||||
/// In practice, sometimes the device gets really busy for a while and
|
||||
/// even two seconds isn't enough, which means that this is still racy
|
||||
/// and a source of flakes.
|
||||
/// The two-second gap should be long enough for the raster thread to finish
|
||||
/// rasterizing the frame, but not longer than necessary to keep driver tests
|
||||
/// as fast a possible.
|
||||
///
|
||||
/// ---------------------------------------------------------------
|
||||
/// With this delay, if we're not lucky:
|
||||
/// ---------------------------------------------------------------
|
||||
/// UI : <-- build -->
|
||||
/// Raster: <-- rasterize randomly slow today -->
|
||||
/// Gap : | 2 seconds or more |
|
||||
/// Driver: <-- screenshot -->
|
||||
///
|
||||
/// In practice, sometimes the device gets really busy for a while and even
|
||||
/// two seconds isn't enough, which means that this is still racy and a source
|
||||
/// of flakes.
|
||||
Future<List<int>> screenshot() async {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@@ -305,10 +305,11 @@ class PackagesInteractiveGetCommand extends FlutterCommand {
|
||||
List<String> rest = argResults.rest;
|
||||
final bool isHelp = rest.contains('-h') || rest.contains('--help');
|
||||
String target;
|
||||
if (rest.length == 1 && (rest[0].contains('/') || rest[0].contains(r'\'))) {
|
||||
// HACK: Supporting flutter specific behavior where you can pass a
|
||||
// folder to the command.
|
||||
target = findProjectRoot(globals.fs, rest[0]);
|
||||
if (rest.length == 1 && (rest.single.contains('/') || rest.single.contains(r'\'))) {
|
||||
// For historical reasons, if there is one argument to the command and it contains
|
||||
// a multiple-component path (i.e. contains a slash) then we use that to determine
|
||||
// to which project we're applying the command.
|
||||
target = findProjectRoot(globals.fs, rest.single);
|
||||
rest = <String>[];
|
||||
} else {
|
||||
target = findProjectRoot(globals.fs);
|
||||
|
||||
Reference in New Issue
Block a user