From cecb0cabd6b2bde2d645983082d3d38c6f595a03 Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Tue, 24 Oct 2023 16:21:14 +0000 Subject: [PATCH] [bisect_dart] Enable further analysis for bisect_dart tool I know this is just an unpublished tool, but enabling the expanded analysis at least makes the development experience consistent with other packages within `/pkg`. Change-Id: Id4daf75cf37042662e3ab3c75dc4c4f856fd4099 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329864 Auto-Submit: Parker Lougheed Commit-Queue: Daco Harkes Reviewed-by: William Hesse Reviewed-by: Daco Harkes --- pkg/bisect_dart/analysis_options.yaml | 1 + pkg/bisect_dart/lib/src/bisection_config.dart | 10 +++++----- pkg/bisect_dart/lib/src/run_bisection.dart | 6 ++++-- pkg/bisect_dart/pubspec.yaml | 5 ++++- tools/package_deps/bin/package_deps.dart | 5 +++-- 5 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 pkg/bisect_dart/analysis_options.yaml diff --git a/pkg/bisect_dart/analysis_options.yaml b/pkg/bisect_dart/analysis_options.yaml new file mode 100644 index 00000000000..d978f811cce --- /dev/null +++ b/pkg/bisect_dart/analysis_options.yaml @@ -0,0 +1 @@ +include: package:dart_flutter_team_lints/analysis_options.yaml diff --git a/pkg/bisect_dart/lib/src/bisection_config.dart b/pkg/bisect_dart/lib/src/bisection_config.dart index eaf3b23bb26..c03c28c4bf5 100644 --- a/pkg/bisect_dart/lib/src/bisection_config.dart +++ b/pkg/bisect_dart/lib/src/bisection_config.dart @@ -47,7 +47,7 @@ class BisectionConfig { /// /// This will modify the SDK checkout! /// - /// Will be created if it doens't exist. + /// Will be created if it doesn't exist. final Uri sdkPath; static const _sdkPathKey = 'sdk_path'; @@ -100,8 +100,8 @@ class BisectionConfig { 'python3 tools/test.py --build -n dartk-linux-debug-x64 lib_2/isolate/package_resolve_test', ], sdkPath: Directory.current.uri, - failureString: - "Error: The argument type 'String' can't be assigned to the parameter type 'Uri'.", + failureString: "Error: The argument type 'String' can't " + "be assigned to the parameter type 'Uri'.", ); static const _argumentDescriptions = { @@ -130,7 +130,7 @@ The name is used for distinguishing logs. final exampleArguments = _example.asMap().entries.map((e) { var value = e.value; if (value is List) { - value = value.first; + value = value.first as String; } if ((value as String).contains(' ')) { value = '"$value"'; @@ -159,5 +159,5 @@ $descriptions } extension on String { - toPattern() => RegExp(RegExp.escape(this)); + RegExp toPattern() => RegExp(RegExp.escape(this)); } diff --git a/pkg/bisect_dart/lib/src/run_bisection.dart b/pkg/bisect_dart/lib/src/run_bisection.dart index 073f54c0f75..5d5ff5c3ef2 100644 --- a/pkg/bisect_dart/lib/src/run_bisection.dart +++ b/pkg/bisect_dart/lib/src/run_bisection.dart @@ -77,7 +77,9 @@ Future _bisect( final pivotIndex = numCommits ~/ 2; final pivot = commitHashes[pivotIndex]; logger.info( - 'Bisecting ${commitHashes.first}...${commitHashes.last} ($numCommits commits). Trying $pivot.'); + 'Bisecting ${commitHashes.first}...${commitHashes.last} ' + '($numCommits commits). Trying $pivot.', + ); final commitResult = await _checkCommit( pivot, testCommands, @@ -160,7 +162,7 @@ Future _gclientSync(Uri sdkCheckout, Logger logger) { Future _runTest( List testCommands, Uri sdkCheckout, Logger logger) async { - var output = ""; + var output = ''; for (final command in testCommands) { final commandSplit = command.split(' '); final result = await runProcess( diff --git a/pkg/bisect_dart/pubspec.yaml b/pkg/bisect_dart/pubspec.yaml index 9cc20391f77..11b6721bc07 100644 --- a/pkg/bisect_dart/pubspec.yaml +++ b/pkg/bisect_dart/pubspec.yaml @@ -3,9 +3,12 @@ name: bisect_dart publish_to: none environment: - sdk: '>=3.0.0 <4.0.0' + sdk: ^3.1.0 dependencies: cli_config: any intl: any logging: any + +dev_dependencies: + dart_flutter_team_lints: any diff --git a/tools/package_deps/bin/package_deps.dart b/tools/package_deps/bin/package_deps.dart index 9f7aed5fa25..04dbdcd8df8 100644 --- a/tools/package_deps/bin/package_deps.dart +++ b/tools/package_deps/bin/package_deps.dart @@ -230,9 +230,10 @@ class Package implements Comparable { var extraDevDeclarations = Set.from(_declaredDevDependencies) ..removeAll(devdeps); - // Remove package:lints - it's often declared as a dev dependency in order + // Remove package:lints and package:dart_flutter_team_lints - + // They are often declared as dev dependencies in order // to bring in analysis_options configuration files. - extraDevDeclarations.removeAll(['lints']); + extraDevDeclarations.removeAll(const ['lints', 'dart_flutter_team_lints']); if (extraDevDeclarations.isNotEmpty) { out(' ${_printSet(extraDevDeclarations)} declared in ' "'dev_dependencies:' but not used in dev dirs.");