From 003d6ef1d9c0c4f0d2deb5c25dffccf99c0d519e Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 3 Aug 2022 16:13:44 -0700 Subject: [PATCH 1/7] Analyze all dart code --- ci/analyze.sh | 22 ++++--------------- tools/analysis_options.yaml | 5 +++++ tools/api_check/pubspec.yaml | 2 +- .../const_finder/test/const_finder_test.dart | 10 +++++---- tools/const_finder/test/fixtures/lib/box.dart | 4 ++-- .../test/fixtures/lib/consts.dart | 2 +- .../test/fixtures/lib/consts_and_non.dart | 2 +- .../test/fixtures/pkg/package.dart | 2 +- tools/gen_locale.dart | 5 ++++- web_sdk/analysis_options.yaml | 5 +++++ web_sdk/pubspec.yaml | 5 ++++- web_sdk/sdk_rewriter.dart | 6 ++--- web_sdk/test/api_conform_test.dart | 9 ++++---- web_sdk/test/sdk_rewriter_test.dart | 2 +- .../web_engine_tester/lib/static/host.dart | 4 ++-- web_sdk/web_test_utils/lib/environment.dart | 20 ++++++++--------- web_sdk/web_test_utils/lib/goldens.dart | 20 ++++++++--------- web_sdk/web_test_utils/lib/image_compare.dart | 2 +- 18 files changed, 65 insertions(+), 62 deletions(-) create mode 100644 tools/analysis_options.yaml create mode 100644 web_sdk/analysis_options.yaml diff --git a/ci/analyze.sh b/ci/analyze.sh index 62886f53165c7..82dee2a63531c 100755 --- a/ci/analyze.sh +++ b/ci/analyze.sh @@ -46,31 +46,17 @@ echo "Using dart from $DART_BIN" "$DART" --version echo "" -"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/lib/ui" - -"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/lib/spirv" +"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/lib" "$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/ci" "$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/flutter_frontend_server" -"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/tools/licenses" - -"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/testing/litetest" - -"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/testing/benchmark" - -"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/testing/smoke_test_failure" - -"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/testing/dart" - -"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/testing/scenario_app" - -"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/testing/symbols" +"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/tools" -"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/tools/githooks" +"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/testing" -"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/tools/clang_tidy" +"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/web_sdk" echo "" diff --git a/tools/analysis_options.yaml b/tools/analysis_options.yaml new file mode 100644 index 0000000000000..7f47e0448b47f --- /dev/null +++ b/tools/analysis_options.yaml @@ -0,0 +1,5 @@ +include: ../analysis_options.yaml + +linter: + rules: + avoid_print: false diff --git a/tools/api_check/pubspec.yaml b/tools/api_check/pubspec.yaml index 8ac0e26b0dafc..60a1493a0247a 100644 --- a/tools/api_check/pubspec.yaml +++ b/tools/api_check/pubspec.yaml @@ -28,13 +28,13 @@ environment: dependencies: analyzer: any _fe_analyzer_shared: any + pub_semver: any dev_dependencies: async_helper: any expect: any litetest: any path: any - pub_semver: any smith: any dependency_overrides: diff --git a/tools/const_finder/test/const_finder_test.dart b/tools/const_finder/test/const_finder_test.dart index 4289c584fb312..9eac1900b7e97 100644 --- a/tools/const_finder/test/const_finder_test.dart +++ b/tools/const_finder/test/const_finder_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// ignore_for_file: avoid_dynamic_calls + import 'dart:convert' show jsonEncode; import 'dart:io'; @@ -175,7 +177,7 @@ Future main(List args) async { final String frontendServer = args[0]; final String sdkRoot = args[1]; try { - void _checkProcessResult(ProcessResult result) { + void checkProcessResult(ProcessResult result) { if (result.exitCode != 0) { stdout.writeln(result.stdout); stderr.writeln(result.stderr); @@ -186,7 +188,7 @@ Future main(List args) async { stdout.writeln('Generating kernel fixtures...'); stdout.writeln(consts); - _checkProcessResult(Process.runSync(dart, [ + checkProcessResult(Process.runSync(dart, [ frontendServer, '--sdk-root=$sdkRoot', '--target=flutter', @@ -197,7 +199,7 @@ Future main(List args) async { box, ])); - _checkProcessResult(Process.runSync(dart, [ + checkProcessResult(Process.runSync(dart, [ frontendServer, '--sdk-root=$sdkRoot', '--target=flutter', @@ -208,7 +210,7 @@ Future main(List args) async { consts, ])); - _checkProcessResult(Process.runSync(dart, [ + checkProcessResult(Process.runSync(dart, [ frontendServer, '--sdk-root=$sdkRoot', '--target=flutter', diff --git a/tools/const_finder/test/fixtures/lib/box.dart b/tools/const_finder/test/fixtures/lib/box.dart index f84961d10883b..ea31a1ed3be4e 100644 --- a/tools/const_finder/test/fixtures/lib/box.dart +++ b/tools/const_finder/test/fixtures/lib/box.dart @@ -9,9 +9,9 @@ // https://github.com/dart-lang/sdk/blob/ca3ad264a64937d5d336cd04dbf2746d1b7d8fc4/tests/language_2/canonicalize/hashing_memoize_instance_test.dart class Box { + const Box(this.content1, this.content2); final Object content1; final Object content2; - const Box(this.content1, this.content2); } const Box box1_0 = Box(null, null); @@ -217,7 +217,7 @@ const Box box2_98 = Box(box2_97, box2_97); const Box box2_99 = Box(box2_98, box2_98); Object confuse(Box x) { - try { throw x; } catch (e) { return e; } + try { throw x; } catch (e) { return e; } // ignore: only_throw_errors } void main() { diff --git a/tools/const_finder/test/fixtures/lib/consts.dart b/tools/const_finder/test/fixtures/lib/consts.dart index ba66e7a946fb0..a13a5772a4521 100644 --- a/tools/const_finder/test/fixtures/lib/consts.dart +++ b/tools/const_finder/test/fixtures/lib/consts.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: prefer_const_constructors, unused_local_variable +// ignore_for_file: prefer_const_constructors, unused_local_variable, depend_on_referenced_packages import 'dart:core'; import 'package:const_finder_fixtures_package/package.dart'; diff --git a/tools/const_finder/test/fixtures/lib/consts_and_non.dart b/tools/const_finder/test/fixtures/lib/consts_and_non.dart index 6b85ac2687cd3..fa91c318bcb7b 100644 --- a/tools/const_finder/test/fixtures/lib/consts_and_non.dart +++ b/tools/const_finder/test/fixtures/lib/consts_and_non.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: prefer_const_constructors, unused_local_variable +// ignore_for_file: prefer_const_constructors, unused_local_variable, depend_on_referenced_packages import 'dart:core'; import 'package:const_finder_fixtures_package/package.dart'; diff --git a/tools/const_finder/test/fixtures/pkg/package.dart b/tools/const_finder/test/fixtures/pkg/package.dart index 87a92bb57221d..b5256d53e154b 100644 --- a/tools/const_finder/test/fixtures/pkg/package.dart +++ b/tools/const_finder/test/fixtures/pkg/package.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: prefer_const_constructors +// ignore_for_file: prefer_const_constructors, depend_on_referenced_packages import 'package:const_finder_fixtures/target.dart'; void createTargetInPackage() { diff --git a/tools/gen_locale.dart b/tools/gen_locale.dart index 22c4c894a6636..2c4cedcea0d2a 100644 --- a/tools/gen_locale.dart +++ b/tools/gen_locale.dart @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// TODO(goderbauer): Migrate this to null safety, https://github.com/flutter/flutter/issues/108933 +// @dart = 2.7 + // This file is used to generate the switch statements in the Locale class. // See: ../lib/ui/window.dart @@ -30,7 +33,7 @@ Map> parseSection(String section) { } final int colon = line.indexOf(':'); if (colon <= 0) { - throw 'not sure how to deal with "$line"'; + throw StateError('not sure how to deal with "$line"'); } final String name = line.substring(0, colon); final String value = line.substring(colon + 2); diff --git a/web_sdk/analysis_options.yaml b/web_sdk/analysis_options.yaml new file mode 100644 index 0000000000000..7f47e0448b47f --- /dev/null +++ b/web_sdk/analysis_options.yaml @@ -0,0 +1,5 @@ +include: ../analysis_options.yaml + +linter: + rules: + avoid_print: false diff --git a/web_sdk/pubspec.yaml b/web_sdk/pubspec.yaml index cfc4aeca2f5d5..bd2d22bba6c72 100644 --- a/web_sdk/pubspec.yaml +++ b/web_sdk/pubspec.yaml @@ -1,10 +1,13 @@ name: web_sdk_tests -author: Flutter Authors # Keep the SDK version range in sync with lib/web_ui/pubspec.yaml environment: sdk: ">=2.12.0-0 <3.0.0" +dependencies: + args: 2.3.1 + path: 1.8.2 + dev_dependencies: analyzer: 4.3.1 test: 1.21.4 diff --git a/web_sdk/sdk_rewriter.dart b/web_sdk/sdk_rewriter.dart index c71e0d5f8a054..bacc7683443e0 100644 --- a/web_sdk/sdk_rewriter.dart +++ b/web_sdk/sdk_rewriter.dart @@ -10,8 +10,8 @@ import 'package:path/path.dart' as path; final ArgParser argParser = ArgParser() ..addOption('output-dir') ..addOption('input-dir') - ..addFlag('ui', defaultsTo: false) - ..addFlag('engine', defaultsTo: false) + ..addFlag('ui') + ..addFlag('engine') ..addMultiOption('input') ..addOption('stamp'); @@ -170,7 +170,7 @@ String _preprocessEnginePartFile(String source) { // Do nothing. } else { // Insert the part directive at the beginning of the file. - source = 'part of engine;\n' + source; + source = 'part of engine;\n$source'; } return source; } diff --git a/web_sdk/test/api_conform_test.dart b/web_sdk/test/api_conform_test.dart index 1a659ca3790ec..470069e63e52e 100644 --- a/web_sdk/test/api_conform_test.dart +++ b/web_sdk/test/api_conform_test.dart @@ -8,7 +8,6 @@ import 'package:analyzer/dart/analysis/features.dart'; import 'package:analyzer/dart/analysis/results.dart'; import 'package:analyzer/dart/analysis/utilities.dart'; import 'package:analyzer/dart/ast/ast.dart'; -import 'package:pub_semver/pub_semver.dart'; // Ignore members defined on Object. const Set _kObjectMembers = { @@ -187,8 +186,8 @@ void main() { // check nullability if (uiParam is SimpleFormalParameter && webParam is SimpleFormalParameter) { - bool isUiNullable = uiParam.type?.question != null; - bool isWebNullable = webParam.type?.question != null; + final bool isUiNullable = uiParam.type?.question != null; + final bool isWebNullable = webParam.type?.question != null; if (isUiNullable != isWebNullable) { failed = true; print('Warning: lib/ui/ui.dart $className.$methodName parameter $i ' @@ -263,8 +262,8 @@ void main() { '${uiParam.identifier!.name} is named, but not in lib/web_ui/ui.dart.'); } - bool isUiNullable = uiParam.type?.question != null; - bool isWebNullable = webParam.type?.question != null; + final bool isUiNullable = uiParam.type?.question != null; + final bool isWebNullable = webParam.type?.question != null; if (isUiNullable != isWebNullable) { failed = true; print('Warning: lib/ui/ui.dart $typeDefName parameter $i ' diff --git a/web_sdk/test/sdk_rewriter_test.dart b/web_sdk/test/sdk_rewriter_test.dart index 36de7f6939798..4e17279f3353e 100644 --- a/web_sdk/test/sdk_rewriter_test.dart +++ b/web_sdk/test/sdk_rewriter_test.dart @@ -78,7 +78,7 @@ export 'engine/file3.dart'; '$caught', 'Exception: on line 3: unexpected code in /path/to/lib/web_ui/lib/src/engine.dart. ' 'This file may only contain comments and exports. Found:\n' - 'import \'dart:something\';', + "import 'dart:something';", ); }); diff --git a/web_sdk/web_engine_tester/lib/static/host.dart b/web_sdk/web_engine_tester/lib/static/host.dart index e98cc23128f35..f47b5018964d6 100644 --- a/web_sdk/web_engine_tester/lib/static/host.dart +++ b/web_sdk/web_engine_tester/lib/static/host.dart @@ -31,6 +31,8 @@ external _TestRunner? get testRunner; @JS() @anonymous class _JSApi { + external factory _JSApi({void Function() resume, void Function() restartCurrent}); + /// Causes the test runner to resume running, as though the user had clicked /// the "play" button. external Function get resume; @@ -38,8 +40,6 @@ class _JSApi { /// Causes the test runner to restart the current test once it finishes /// running. external Function get restartCurrent; - - external factory _JSApi({void Function() resume, void Function() restartCurrent}); } /// Sets the top-level `dartTest` object so that it's visible to JS. diff --git a/web_sdk/web_test_utils/lib/environment.dart b/web_sdk/web_test_utils/lib/environment.dart index 81466b4bba828..30ea72edb9e1f 100644 --- a/web_sdk/web_test_utils/lib/environment.dart +++ b/web_sdk/web_test_utils/lib/environment.dart @@ -36,6 +36,16 @@ class Environment { return _prepareEnvironmentFromEngineDir(script, directory); } + Environment._({ + required this.self, + required this.webUiRootDir, + required this.engineSrcDir, + required this.engineToolsDir, + required this.outDir, + required this.hostDebugUnoptDir, + required this.dartSdkDir, + }); + static Environment _prepareEnvironmentFromEngineDir( io.File self, io.Directory engineSrcDir) { final io.Directory engineToolsDir = @@ -72,16 +82,6 @@ class Environment { ); } - Environment._({ - required this.self, - required this.webUiRootDir, - required this.engineSrcDir, - required this.engineToolsDir, - required this.outDir, - required this.hostDebugUnoptDir, - required this.dartSdkDir, - }); - /// The Dart script that's currently running. final io.File self; diff --git a/web_sdk/web_test_utils/lib/goldens.dart b/web_sdk/web_test_utils/lib/goldens.dart index 2f3f199614b52..2f05783cbce94 100644 --- a/web_sdk/web_test_utils/lib/goldens.dart +++ b/web_sdk/web_test_utils/lib/goldens.dart @@ -32,6 +32,16 @@ void main(List args) { /// This class encapsulates visually diffing an Image with any other. /// Both images need to be the exact same size. class ImageDiff { + /// Image diff constructor which requires two [Image]s to compare and + /// [PixelComparison] algorithm. + ImageDiff({ + required this.golden, + required this.other, + required this.pixelComparison, + }) { + _computeDiff(); + } + /// The image to match final Image golden; @@ -53,16 +63,6 @@ class ImageDiff { /// This gets set to 1 (100% difference) when golden and other aren't the same size. double get rate => _wrongPixels / _pixelCount; - /// Image diff constructor which requires two [Image]s to compare and - /// [PixelComparison] algorithm. - ImageDiff({ - required this.golden, - required this.other, - required this.pixelComparison, - }) { - _computeDiff(); - } - int _pixelCount = 0; int _wrongPixels = 0; diff --git a/web_sdk/web_test_utils/lib/image_compare.dart b/web_sdk/web_test_utils/lib/image_compare.dart index 29de42db0757e..6bed0dc2d91f7 100644 --- a/web_sdk/web_test_utils/lib/image_compare.dart +++ b/web_sdk/web_test_utils/lib/image_compare.dart @@ -150,7 +150,7 @@ Golden file $filename did not match the image generated by the test. Future _getGolden(String filename) { // TODO(mdebbar): Fetch the golden from Skia Gold. - return Future.value(null); + return Future.value(); } String _getFullScreenshotPath(String filename) { From e36cd15d6a32f14f9671bbb558e5fc220dfcba0b Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 4 Aug 2022 11:35:09 -0700 Subject: [PATCH 2/7] remove web_ui --- ci/analyze.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ci/analyze.sh b/ci/analyze.sh index 82dee2a63531c..7a1a89834c08e 100755 --- a/ci/analyze.sh +++ b/ci/analyze.sh @@ -46,7 +46,9 @@ echo "Using dart from $DART_BIN" "$DART" --version echo "" -"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/lib" +"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/lib/ui" + +"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/lib/spirv" "$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/ci" From d6f17608fd852dbbd68fe31bf5b1e1b2139c54a6 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 4 Aug 2022 11:36:10 -0700 Subject: [PATCH 3/7] ++ --- ci/analyze.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ci/analyze.sh b/ci/analyze.sh index 7a1a89834c08e..28a50bc12ccd3 100755 --- a/ci/analyze.sh +++ b/ci/analyze.sh @@ -58,13 +58,14 @@ echo "" "$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/testing" -"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/web_sdk" - echo "" # Check that dart libraries conform. echo "Checking the integrity of the Web SDK" (cd "$FLUTTER_DIR/web_sdk"; "$DART" pub get) + +"$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/web_sdk" + WEB_SDK_TEST_FILES="$FLUTTER_DIR/web_sdk/test/*" for testFile in $WEB_SDK_TEST_FILES do From 9361b77cc19d340ee0ae9c4172a1ab83c05e37db Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 4 Aug 2022 14:24:52 -0700 Subject: [PATCH 4/7] more fixes --- tools/api_check/lib/apicheck.dart | 4 ++-- web_sdk/web_engine_tester/lib/golden_tester.dart | 2 +- web_sdk/web_engine_tester/lib/static/host.dart | 4 +++- web_sdk/web_engine_tester/pubspec.yaml | 1 + web_sdk/web_test_utils/lib/goldens.dart | 2 -- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/api_check/lib/apicheck.dart b/tools/api_check/lib/apicheck.dart index 1ba28a086c001..8413cc6f37e95 100644 --- a/tools/api_check/lib/apicheck.dart +++ b/tools/api_check/lib/apicheck.dart @@ -36,11 +36,11 @@ List getDartClassFields({ final RegExp fieldExp = RegExp(r'_k(\w*)Index'); final List fields = []; for (final CompilationUnitMember unitMember in result.unit.declarations) { - if (unitMember is ClassDeclaration && unitMember.name.name == className) { + if (unitMember is ClassDeclaration && unitMember.name.name == className) { // ignore: deprecated_member_use for (final ClassMember classMember in unitMember.members) { if (classMember is FieldDeclaration) { for (final VariableDeclaration field in classMember.fields.variables) { - final String fieldName = field.name.name; + final String fieldName = field.name.name; // ignore: deprecated_member_use final RegExpMatch? match = fieldExp.firstMatch(fieldName); if (match != null) { fields.add(match.group(1)!); diff --git a/web_sdk/web_engine_tester/lib/golden_tester.dart b/web_sdk/web_engine_tester/lib/golden_tester.dart index e5c2f04a9667a..732866637ec64 100644 --- a/web_sdk/web_engine_tester/lib/golden_tester.dart +++ b/web_sdk/web_engine_tester/lib/golden_tester.dart @@ -7,7 +7,7 @@ import 'dart:convert'; import 'package:test/test.dart'; // ignore: implementation_imports -import 'package:ui/src/engine.dart' show operatingSystem, OperatingSystem, useCanvasKit; +import 'package:ui/src/engine.dart' show OperatingSystem, operatingSystem, useCanvasKit; // ignore: implementation_imports import 'package:ui/src/engine/dom.dart'; import 'package:ui/ui.dart'; diff --git a/web_sdk/web_engine_tester/lib/static/host.dart b/web_sdk/web_engine_tester/lib/static/host.dart index f47b5018964d6..9f066918ee2b2 100644 --- a/web_sdk/web_engine_tester/lib/static/host.dart +++ b/web_sdk/web_engine_tester/lib/static/host.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// ignore_for_file: avoid_dynamic_calls + @JS() library test.host; @@ -22,7 +24,7 @@ class _TestRunner { /// Returns the current content shell runner, or `null` if none exists. @JS() -external _TestRunner? get testRunner; +external _TestRunner? get testRunner; // ignore: library_private_types_in_public_api /// A class that exposes the test API to JS. /// diff --git a/web_sdk/web_engine_tester/pubspec.yaml b/web_sdk/web_engine_tester/pubspec.yaml index 489401ff2913e..25219b1071327 100644 --- a/web_sdk/web_engine_tester/pubspec.yaml +++ b/web_sdk/web_engine_tester/pubspec.yaml @@ -9,5 +9,6 @@ dependencies: stream_channel: 2.1.0 test: 1.17.7 webkit_inspection_protocol: 1.0.0 + stack_trace: 1.10.0 ui: path: ../../lib/web_ui diff --git a/web_sdk/web_test_utils/lib/goldens.dart b/web_sdk/web_test_utils/lib/goldens.dart index 2f05783cbce94..c41cd40d1db75 100644 --- a/web_sdk/web_test_utils/lib/goldens.dart +++ b/web_sdk/web_test_utils/lib/goldens.dart @@ -136,8 +136,6 @@ class ImageDiff { getGreen(pixel), getBlue(pixel), ]; - default: - throw 'Unrecognized pixel comparison value: $pixelComparison'; } } From 03fa338741cd779cf892178dba43405aa769fa79 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 4 Aug 2022 14:29:09 -0700 Subject: [PATCH 5/7] remove web_sdk analysis_options --- web_sdk/analysis_options.yaml | 5 ----- web_sdk/test/api_conform_test.dart | 2 ++ web_sdk/test/js_access_test.dart | 2 ++ web_sdk/web_engine_tester/lib/static/host.dart | 2 +- web_sdk/web_test_utils/lib/goldens.dart | 2 +- web_sdk/web_test_utils/lib/image_compare.dart | 6 +++--- 6 files changed, 9 insertions(+), 10 deletions(-) delete mode 100644 web_sdk/analysis_options.yaml diff --git a/web_sdk/analysis_options.yaml b/web_sdk/analysis_options.yaml deleted file mode 100644 index 7f47e0448b47f..0000000000000 --- a/web_sdk/analysis_options.yaml +++ /dev/null @@ -1,5 +0,0 @@ -include: ../analysis_options.yaml - -linter: - rules: - avoid_print: false diff --git a/web_sdk/test/api_conform_test.dart b/web_sdk/test/api_conform_test.dart index 470069e63e52e..755b6f9a3345c 100644 --- a/web_sdk/test/api_conform_test.dart +++ b/web_sdk/test/api_conform_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// ignore_for_file: avoid_print + import 'dart:io'; import 'package:analyzer/dart/analysis/features.dart'; diff --git a/web_sdk/test/js_access_test.dart b/web_sdk/test/js_access_test.dart index ee41a1e83d880..985ab28e3180d 100644 --- a/web_sdk/test/js_access_test.dart +++ b/web_sdk/test/js_access_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// ignore_for_file: avoid_print + /// Checks that JavaScript API is accessed properly. /// /// JavaScript access needs to be audited to make sure it follows security best diff --git a/web_sdk/web_engine_tester/lib/static/host.dart b/web_sdk/web_engine_tester/lib/static/host.dart index 9f066918ee2b2..320dba2134da1 100644 --- a/web_sdk/web_engine_tester/lib/static/host.dart +++ b/web_sdk/web_engine_tester/lib/static/host.dart @@ -162,7 +162,7 @@ void main() { })); }, (dynamic error, StackTrace stackTrace) { - print('$error\n${Trace.from(stackTrace).terse}'); + print('$error\n${Trace.from(stackTrace).terse}'); // ignore: avoid_print }, ); } diff --git a/web_sdk/web_test_utils/lib/goldens.dart b/web_sdk/web_test_utils/lib/goldens.dart index c41cd40d1db75..e39e1f7fa4863 100644 --- a/web_sdk/web_test_utils/lib/goldens.dart +++ b/web_sdk/web_test_utils/lib/goldens.dart @@ -26,7 +26,7 @@ void main(List args) { final Image imageB = decodeNamedImage(fileB.readAsBytesSync(), 'b.png')!; final ImageDiff diff = ImageDiff( golden: imageA, other: imageB, pixelComparison: PixelComparison.fuzzy); - print('Diff: ${(diff.rate * 100).toStringAsFixed(4)}%'); + print('Diff: ${(diff.rate * 100).toStringAsFixed(4)}%'); // ignore: avoid_print } /// This class encapsulates visually diffing an Image with any other. diff --git a/web_sdk/web_test_utils/lib/image_compare.dart b/web_sdk/web_test_utils/lib/image_compare.dart index 6bed0dc2d91f7..aeadee1863841 100644 --- a/web_sdk/web_test_utils/lib/image_compare.dart +++ b/web_sdk/web_test_utils/lib/image_compare.dart @@ -72,7 +72,7 @@ Future compareImage( // At the moment, we don't support local screenshot testing because we use // Skia Gold to handle our screenshots and diffing. In the future, we might // implement local screenshot testing if there's a need. - print('Screenshot generated: file://$screenshotPath'); + print('Screenshot generated: file://$screenshotPath'); // ignore: avoid_print return 'OK'; } @@ -137,8 +137,8 @@ Golden file $filename did not match the image generated by the test. if (diff.rate < maxDiffRateFailure) { // Issue a warning but do not fail the test. - print('WARNING:'); - print(message); + print('WARNING:'); // ignore: avoid_print + print(message); // ignore: avoid_print return 'OK'; } else { // Fail test From 48374d46c696f36ae0a88675503d7c1c4990d5f1 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 4 Aug 2022 15:02:13 -0700 Subject: [PATCH 6/7] Update analyze.sh --- ci/analyze.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/analyze.sh b/ci/analyze.sh index 28a50bc12ccd3..76ddd724d0c19 100755 --- a/ci/analyze.sh +++ b/ci/analyze.sh @@ -56,6 +56,7 @@ echo "" "$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/tools" +(cd "$FLUTTER_DIR/testing/skia_gold_client"; "$DART" pub get) "$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/testing" echo "" From fc511bc2c48adf1740026a3d4a2878d4ad9a19a1 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 4 Aug 2022 15:29:04 -0700 Subject: [PATCH 7/7] Update analyze.sh --- ci/analyze.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/analyze.sh b/ci/analyze.sh index 76ddd724d0c19..fbfa6b7805d94 100755 --- a/ci/analyze.sh +++ b/ci/analyze.sh @@ -64,6 +64,8 @@ echo "" # Check that dart libraries conform. echo "Checking the integrity of the Web SDK" (cd "$FLUTTER_DIR/web_sdk"; "$DART" pub get) +(cd "$FLUTTER_DIR/web_sdk/web_test_utils"; "$DART" pub get) +(cd "$FLUTTER_DIR/web_sdk/web_engine_tester"; "$DART" pub get) "$DART" analyze --fatal-infos --fatal-warnings "$FLUTTER_DIR/web_sdk"