From 060e4608b1e8faca0b6f3daa66e35c2611d6a3a8 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Mon, 16 Aug 2021 21:37:03 -0700 Subject: [PATCH] clean up stale or unnecessary TODOS (#88308) --- dev/devicelab/lib/tasks/web_dev_mode_tests.dart | 7 ++++--- .../flutter/lib/src/animation/animation_controller.dart | 4 +++- packages/flutter_test/lib/src/_goldens_io.dart | 2 +- packages/flutter_test/lib/src/goldens.dart | 4 ++-- packages/flutter_tools/bin/fuchsia_attach.dart | 4 ++-- .../flutter_tools/lib/src/build_system/build_system.dart | 2 +- .../lib/src/build_system/targets/localizations.dart | 3 --- packages/flutter_tools/lib/src/commands/create_base.dart | 4 +--- packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart | 3 --- packages/flutter_tools/lib/src/mdns_discovery.dart | 1 - packages/flutter_tools/lib/src/test/runner.dart | 2 -- packages/flutter_tools/lib/src/tester/flutter_tester.dart | 3 --- packages/flutter_tools/lib/src/web/bootstrap.dart | 1 - packages/flutter_tools/lib/src/web/web_device.dart | 4 ++-- .../test/general.shard/tester/flutter_tester_test.dart | 1 - 15 files changed, 16 insertions(+), 29 deletions(-) diff --git a/dev/devicelab/lib/tasks/web_dev_mode_tests.dart b/dev/devicelab/lib/tasks/web_dev_mode_tests.dart index 22aa5add24..0fc6a52e91 100644 --- a/dev/devicelab/lib/tasks/web_dev_mode_tests.dart +++ b/dev/devicelab/lib/tasks/web_dev_mode_tests.dart @@ -21,7 +21,6 @@ const String kFirstRecompileTime = 'FirstRecompileTime'; const String kSecondStartupTime = 'SecondStartupTime'; const String kSecondRestartTime = 'SecondRestartTime'; - abstract class WebDevice { static const String chrome = 'chrome'; static const String webServer = 'web-server'; @@ -61,7 +60,8 @@ TaskFunction createWebDevModeTest(String webDevice, bool enableIncrementalCompil .transform(utf8.decoder) .transform(const LineSplitter()) .listen((String line) { - // TODO(jonahwilliams): non-dwds builds do not know when the browser is loaded. + // non-dwds builds do not know when the browser is loaded so keep trying + // until this succeeds. if (line.contains('Ignoring terminal input')) { Future.delayed(const Duration(seconds: 1)).then((void _) { process.stdin.write(restarted ? 'q' : 'r'); @@ -139,7 +139,8 @@ TaskFunction createWebDevModeTest(String webDevice, bool enableIncrementalCompil .transform(utf8.decoder) .transform(const LineSplitter()) .listen((String line) { - // TODO(jonahwilliams): non-dwds builds do not know when the browser is loaded. + // non-dwds builds do not know when the browser is loaded so keep trying + // until this succeeds. if (line.contains('Ignoring terminal input')) { Future.delayed(const Duration(seconds: 1)).then((void _) { process.stdin.write(restarted ? 'q' : 'r'); diff --git a/packages/flutter/lib/src/animation/animation_controller.dart b/packages/flutter/lib/src/animation/animation_controller.dart index 226f368b62..254a6ab33e 100644 --- a/packages/flutter/lib/src/animation/animation_controller.dart +++ b/packages/flutter/lib/src/animation/animation_controller.dart @@ -572,7 +572,9 @@ class AnimationController extends Animation case AnimationBehavior.normal: // Since the framework cannot handle zero duration animations, we run it at 5% of the normal // duration to limit most animations to a single frame. - // TODO(jonahwilliams): determine a better process for setting duration. + // Ideally, the framework would be able to handle zero duration animations, however, the common + // pattern of an eternally repeating animation might cause an endless loop if it weren't delayed + // for at least one frame. scale = 0.05; break; case AnimationBehavior.preserve: diff --git a/packages/flutter_test/lib/src/_goldens_io.dart b/packages/flutter_test/lib/src/_goldens_io.dart index 68ad87e9fe..fd854fd6d9 100644 --- a/packages/flutter_test/lib/src/_goldens_io.dart +++ b/packages/flutter_test/lib/src/_goldens_io.dart @@ -143,7 +143,7 @@ mixin LocalComparisonOutput { String additionalFeedback = ''; if (result.diffs != null) { additionalFeedback = '\nFailure feedback can be found at ${path.join(basedir.path, 'failures')}'; - final Map diffs = result.diffs!.cast(); + final Map diffs = result.diffs!; for (final MapEntry entry in diffs.entries) { final File output = getFailureFile( key.isEmpty ? entry.key : '${entry.key}_$key', diff --git a/packages/flutter_test/lib/src/goldens.dart b/packages/flutter_test/lib/src/goldens.dart index 053f0a5a01..f88306f43c 100644 --- a/packages/flutter_test/lib/src/goldens.dart +++ b/packages/flutter_test/lib/src/goldens.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. import 'dart:typed_data'; +import 'dart:ui'; import 'package:path/path.dart' as path; import '_goldens_io.dart' if (dart.library.html) '_goldens_web.dart' as _goldens; @@ -326,8 +327,7 @@ class ComparisonResult { /// Map containing differential images to illustrate found variants in pixel /// values in the execution of the pixel test. - // TODO(jonahwilliams): fix type signature when image is updated to support web. - final Map? diffs; + final Map? diffs; /// The calculated percentage of pixel difference between two images. final double diffPercent; diff --git a/packages/flutter_tools/bin/fuchsia_attach.dart b/packages/flutter_tools/bin/fuchsia_attach.dart index d5b9c854fb..b4e3b5590c 100644 --- a/packages/flutter_tools/bin/fuchsia_attach.dart +++ b/packages/flutter_tools/bin/fuchsia_attach.dart @@ -55,7 +55,7 @@ Future main(List args) async { final String packages = '$buildDirectory/dartlang/gen/$path/${name}_dart_library.packages'; final String outputDill = '$buildDirectory/${name}_tmp.dill'; - // TODO(jonahwilliams): running from fuchsia root hangs hot reload for some reason. + // Running from fuchsia root hangs hot reload for some reason. // switch to the project root directory and run from there. originalWorkingDirectory = globals.fs.currentDirectory.path; globals.fs.currentDirectory = path; @@ -92,7 +92,7 @@ Future main(List args) async { '--target', targetFile, '--target-model', - 'flutter', // TODO(jonahwilliams): change to flutter_runner when dart SDK rolls + 'flutter_runner', '--output-dill', outputDill, '--packages', diff --git a/packages/flutter_tools/lib/src/build_system/build_system.dart b/packages/flutter_tools/lib/src/build_system/build_system.dart index 9fb5644a6d..79e808c308 100644 --- a/packages/flutter_tools/lib/src/build_system/build_system.dart +++ b/packages/flutter_tools/lib/src/build_system/build_system.dart @@ -605,7 +605,7 @@ class FlutterBuildSystem extends BuildSystem { // Always persist the file cache to disk. fileCache.persist(); } - // TODO(jonahwilliams): this is a bit of a hack, due to various parts of + // This is a bit of a hack, due to various parts of // the flutter tool writing these files unconditionally. Since Xcode uses // timestamps to track files, this leads to unnecessary rebuilds if they // are included. Once all the places that write these files have been diff --git a/packages/flutter_tools/lib/src/build_system/targets/localizations.dart b/packages/flutter_tools/lib/src/build_system/targets/localizations.dart index 05c0e7fd38..2e558be531 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/localizations.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/localizations.dart @@ -23,9 +23,6 @@ class GenerateLocalizationsTarget extends Target { List get inputs => [ // This is added as a convenience for developing the tool. const Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/localizations.dart'), - // TODO(jonahwilliams): once https://github.com/flutter/flutter/issues/56321 is - // complete, we should add the artifact as a dependency here. Since the tool runs - // this code from source, looking up each dependency will be cumbersome. ]; @override diff --git a/packages/flutter_tools/lib/src/commands/create_base.dart b/packages/flutter_tools/lib/src/commands/create_base.dart index 6674b7c4ef..5f237d4db7 100644 --- a/packages/flutter_tools/lib/src/commands/create_base.dart +++ b/packages/flutter_tools/lib/src/commands/create_base.dart @@ -371,9 +371,7 @@ abstract class CreateBase extends FlutterCommand { 'pluginClassSnakeCase': pluginClassSnakeCase, 'pluginClassCapitalSnakeCase': pluginClassCapitalSnakeCase, 'pluginDartClass': pluginDartClass, - // TODO(jonahwilliams): update after google3 uuid is updated. - // ignore: prefer_const_constructors - 'pluginProjectUUID': Uuid().v4().toUpperCase(), + 'pluginProjectUUID': const Uuid().v4().toUpperCase(), 'withPluginHook': withPluginHook, 'androidLanguage': androidLanguage, 'iosLanguage': iosLanguage, diff --git a/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart b/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart index fc58f0e896..95602da610 100644 --- a/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart +++ b/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart @@ -740,9 +740,6 @@ class FuchsiaDevice extends Device { /// provided set of `ports`. /// /// Returns null if no isolate port can be found. - /// - // TODO(jonahwilliams): replacing this with the hub will require an update - // to the flutter_runner. Future findIsolatePort(String isolateName, List ports) async { for (final int port in ports) { try { diff --git a/packages/flutter_tools/lib/src/mdns_discovery.dart b/packages/flutter_tools/lib/src/mdns_discovery.dart index 2bd939cb06..e152bcd95b 100644 --- a/packages/flutter_tools/lib/src/mdns_discovery.dart +++ b/packages/flutter_tools/lib/src/mdns_discovery.dart @@ -58,7 +58,6 @@ class MDnsObservatoryDiscovery { /// If it is null and there is only one available instance of Observatory, /// it will return that instance's information regardless of what application /// the Observatory instance is for. - // TODO(jonahwilliams): use `deviceVmservicePort` to filter mdns results. @visibleForTesting Future query({String applicationId, int deviceVmservicePort}) async { _logger.printTrace('Checking for advertised Dart observatories...'); diff --git a/packages/flutter_tools/lib/src/test/runner.dart b/packages/flutter_tools/lib/src/test/runner.dart index 32fad4dcc2..b622469bee 100644 --- a/packages/flutter_tools/lib/src/test/runner.dart +++ b/packages/flutter_tools/lib/src/test/runner.dart @@ -155,8 +155,6 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner { testWrapper.registerPlatformPlugin( [Runtime.chrome], () { - // TODO(jonahwilliams): refactor this into a factory that handles - // providing dependencies. return FlutterWebPlatform.start( flutterProject.directory.path, updateGoldens: updateGoldens, diff --git a/packages/flutter_tools/lib/src/tester/flutter_tester.dart b/packages/flutter_tools/lib/src/tester/flutter_tester.dart index f9cd32436a..770985b355 100644 --- a/packages/flutter_tools/lib/src/tester/flutter_tester.dart +++ b/packages/flutter_tools/lib/src/tester/flutter_tester.dart @@ -54,9 +54,6 @@ class FlutterTesterDevice extends Device { @required ProcessManager processManager, @required FlutterVersion flutterVersion, @required Logger logger, - // TODO(jonahwilliams): remove once g3 rolls. - // ignore: avoid_unused_constructor_parameters - String buildDirectory, @required FileSystem fileSystem, @required Artifacts artifacts, @required OperatingSystemUtils operatingSystemUtils, diff --git a/packages/flutter_tools/lib/src/web/bootstrap.dart b/packages/flutter_tools/lib/src/web/bootstrap.dart index 4aa27f0027..a232b672be 100644 --- a/packages/flutter_tools/lib/src/web/bootstrap.dart +++ b/packages/flutter_tools/lib/src/web/bootstrap.dart @@ -129,7 +129,6 @@ String generateMainModule({ required bool nativeNullAssertions, String bootstrapModule = 'main_module.bootstrap', }) { - // TODO(jonahwilliams): fix typo in dwds and update. return ''' /* ENTRYPOINT_EXTENTION_MARKER */ // Create the main module loaded below. diff --git a/packages/flutter_tools/lib/src/web/web_device.dart b/packages/flutter_tools/lib/src/web/web_device.dart index da1ea5c854..a6237e200d 100644 --- a/packages/flutter_tools/lib/src/web/web_device.dart +++ b/packages/flutter_tools/lib/src/web/web_device.dart @@ -57,8 +57,8 @@ abstract class ChromiumDevice extends Device { /// The active chrome instance. Chromium _chrome; - // TODO(jonahwilliams): this is technically false, but requires some refactoring - // to allow hot mode restart only devices. + // This device does not actually support hot reload, but the current implementation of the resident runner + // requires both supportsHotReload and supportsHotRestart to be true in order to allow hot restart. @override bool get supportsHotReload => true; diff --git a/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart b/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart index 93d5ba2243..0e70e08122 100644 --- a/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart +++ b/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart @@ -96,7 +96,6 @@ void main() { fileSystem: fileSystem, processManager: fakeProcessManager, artifacts: Artifacts.test(), - buildDirectory: 'build', logger: BufferLogger.test(), flutterVersion: FakeFlutterVersion(), operatingSystemUtils: FakeOperatingSystemUtils(),