From 73301a35a22824edff155836461747d8e04d448d Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Fri, 16 Oct 2020 00:37:04 +0200 Subject: [PATCH] Sync lints (#68136) --- analysis_options.yaml | 13 +++++++ .../localization/bin/gen_subtag_registry.dart | 3 +- .../language_subtag_registry.dart | 3 +- dev/tools/update_icons.dart | 4 +- .../lib/src/cupertino/context_menu.dart | 10 ++--- .../lib/src/cupertino/date_picker.dart | 2 - .../flutter/lib/src/cupertino/nav_bar.dart | 1 - .../flutter/lib/src/cupertino/refresh.dart | 2 +- .../lib/src/cupertino/text_selection.dart | 2 +- .../flutter/lib/src/gestures/converter.dart | 2 +- packages/flutter/lib/src/material/about.dart | 2 - .../pickers/calendar_date_range_picker.dart | 2 +- .../lib/src/material/reorderable_list.dart | 4 -- .../lib/src/services/raw_keyboard_web.dart | 1 - .../lib/src/widgets/interactive_viewer.dart | 3 +- .../test/widgets/dismissible_test.dart | 4 -- .../test/widgets/editable_text_test.dart | 4 -- .../lib/src/commands/attach.dart | 23 +++++------ .../lib/src/commands/create.dart | 20 +++++----- .../lib/src/commands/ide_config.dart | 14 +++---- .../src/localizations/gen_l10n_templates.dart | 38 ++++++++++--------- .../language_subtag_registry.dart | 3 +- .../flutter_tools/lib/src/web/bootstrap.dart | 3 +- .../hermetic/build_linux_test.dart | 17 +++++---- .../hermetic/build_macos_test.dart | 17 +++++---- .../hermetic/build_windows_test.dart | 23 ++++++----- .../hermetic/build_xcarchive_test.dart | 17 +++++---- .../hermetic/generate_localizations_test.dart | 9 +++-- .../permeable/analyze_once_test.dart | 3 +- .../general.shard/android/gradle_test.dart | 15 ++++---- .../general.shard/base/analyze_size_test.dart | 3 +- .../general.shard/resident_runner_test.dart | 6 ++- .../general.shard/web/bootstrap_test.dart | 4 +- 33 files changed, 145 insertions(+), 132 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 4e5532d00d..9a6e73132d 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -53,6 +53,7 @@ linter: # - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219 - always_require_non_null_named_parameters - always_specify_types + # - always_use_package_imports # we do this commonly - annotate_overrides # - avoid_annotating_with_dynamic # conflicts with always_specify_types # - avoid_as # required for implicit-casts: true @@ -63,6 +64,7 @@ linter: # - avoid_double_and_int_checks # only useful when targeting JS runtime - avoid_empty_else - avoid_equals_and_hash_code_on_mutable_classes + # - avoid_escaping_inner_quotes # not yet tested - avoid_field_initializers_in_const_classes - avoid_function_literals_in_foreach_calls # - avoid_implementing_value_types # not yet tested @@ -84,6 +86,7 @@ linter: # - avoid_shadowing_type_parameters # not yet tested - avoid_single_cascade_in_expression_statements - avoid_slow_async_io + # - avoid_type_to_string # we do this commonly - avoid_types_as_parameter_names # - avoid_types_on_closure_parameters # conflicts with always_specify_types # - avoid_unnecessary_containers # not yet tested @@ -103,9 +106,11 @@ linter: # - curly_braces_in_flow_control_structures # not yet tested # - diagnostic_describe_all_properties # not yet tested - directives_ordering + # - do_not_use_environment # we do this commonly - empty_catches - empty_constructor_bodies - empty_statements + - exhaustive_cases # - file_names # not yet tested - flutter_style_todos - hash_and_equals @@ -113,6 +118,7 @@ linter: # - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811 - iterable_contains_unrelated_type # - join_return_with_assignment # not yet tested + - leading_newlines_in_multiline_strings - library_names - library_prefixes # - lines_longer_than_80_chars # not yet tested @@ -120,6 +126,7 @@ linter: # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181 # - missing_whitespace_between_adjacent_strings # not yet tested - no_adjacent_strings_in_list + # - no_default_cases # too many false positives - no_duplicate_case_values # - no_logic_in_create_state # not yet tested # - no_runtimeType_toString # not yet tested @@ -175,6 +182,7 @@ linter: # - provide_deprecation_message # not yet tested # - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml - recursive_getters + # - sized_box_for_whitespace # not yet tested - slash_for_doc_comments # - sort_child_properties_last # not yet tested - sort_constructors_first @@ -194,19 +202,24 @@ linter: # - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498 - unnecessary_new - unnecessary_null_aware_assignments + # - unnecessary_null_checks # not yet tested - unnecessary_null_in_if_null_operators - unnecessary_nullable_for_final_variable_declarations - unnecessary_overrides - unnecessary_parenthesis + # - unnecessary_raw_strings # not yet tested - unnecessary_statements + # - unnecessary_string_escapes # not yet tested - unnecessary_string_interpolations - unnecessary_this - unrelated_type_equality_checks # - unsafe_html # not yet tested - use_full_hex_values_for_flutter_colors # - use_function_type_syntax_for_parameters # not yet tested + # - use_is_even_rather_than_modulo # not yet tested # - use_key_in_widget_constructors # not yet tested - use_late_for_private_fields_and_variables + # - use_raw_strings # not yet tested - use_rethrow_when_possible # - use_setters_to_change_properties # not yet tested # - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182 diff --git a/dev/tools/localization/bin/gen_subtag_registry.dart b/dev/tools/localization/bin/gen_subtag_registry.dart index 76a683d67e..b1b2cbea33 100644 --- a/dev/tools/localization/bin/gen_subtag_registry.dart +++ b/dev/tools/localization/bin/gen_subtag_registry.dart @@ -19,7 +19,8 @@ Future main() async { final File subtagRegistry = File('../language_subtag_registry.dart'); final File subtagRegistryFlutterTools = File('../../../../packages/flutter_tools/lib/src/localizations/language_subtag_registry.dart'); - final String content = '''// Copyright 2014 The Flutter Authors. All rights reserved. + final String content = ''' +// Copyright 2014 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/dev/tools/localization/language_subtag_registry.dart b/dev/tools/localization/language_subtag_registry.dart index 278b62a41d..6372d6dfca 100644 --- a/dev/tools/localization/language_subtag_registry.dart +++ b/dev/tools/localization/language_subtag_registry.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. /// Cache of https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry. -const String languageSubtagRegistry = '''File-Date: 2020-03-16 +const String languageSubtagRegistry = ''' +File-Date: 2020-03-16 %% Type: language Subtag: aa diff --git a/dev/tools/update_icons.dart b/dev/tools/update_icons.dart index b0416155f3..2377043715 100644 --- a/dev/tools/update_icons.dart +++ b/dev/tools/update_icons.dart @@ -253,8 +253,8 @@ void _testIsMapSuperset(Map newCodepoints, Map o final Set oldCodepointsSet = oldCodepoints.keys.toSet(); if (!newCodepointsSet.containsAll(oldCodepointsSet)) { - stderr.writeln( - '''Error: New codepoints file does not contain all the existing codepoints.\n + stderr.writeln(''' +Error: New codepoints file does not contain all the existing codepoints.\n Missing: ${oldCodepointsSet.difference(newCodepointsSet)} ''', ); diff --git a/packages/flutter/lib/src/cupertino/context_menu.dart b/packages/flutter/lib/src/cupertino/context_menu.dart index a10512ae91..a74d10496e 100644 --- a/packages/flutter/lib/src/cupertino/context_menu.dart +++ b/packages/flutter/lib/src/cupertino/context_menu.dart @@ -652,7 +652,7 @@ class _ContextMenuRoute extends PopupRoute { return AlignmentDirectional.topCenter; case _ContextMenuLocation.right: return AlignmentDirectional.topEnd; - default: + case _ContextMenuLocation.left: return AlignmentDirectional.topStart; } } @@ -671,7 +671,7 @@ class _ContextMenuRoute extends PopupRoute { ? childRect.bottomRight : childRect.topRight; return (target - Offset(sheetRect.width, 0.0)) & sheetRect.size; - default: + case _ContextMenuLocation.left: final Offset target = orientation == Orientation.portrait ? childRect.bottomLeft : childRect.topLeft; @@ -978,7 +978,7 @@ class _ContextMenuRouteStaticState extends State<_ContextMenuRouteStatic> with T return orientation == Orientation.portrait ? Alignment.bottomCenter : Alignment.topLeft; - default: + case _ContextMenuLocation.left: return orientation == Orientation.portrait ? Alignment.bottomCenter : Alignment.topRight; @@ -1060,7 +1060,7 @@ class _ContextMenuRouteStaticState extends State<_ContextMenuRouteStatic> with T return orientation == Orientation.portrait ? [child, spacer, sheet] : [sheet, spacer, child]; - default: + case _ContextMenuLocation.left: return [child, spacer, sheet]; } } @@ -1233,7 +1233,7 @@ class _ContextMenuSheet extends StatelessWidget { ), menu, ]; - default: + case _ContextMenuLocation.left: return [ menu, const Spacer( diff --git a/packages/flutter/lib/src/cupertino/date_picker.dart b/packages/flutter/lib/src/cupertino/date_picker.dart index 236aaf7aad..da422f3884 100644 --- a/packages/flutter/lib/src/cupertino/date_picker.dart +++ b/packages/flutter/lib/src/cupertino/date_picker.dart @@ -1363,8 +1363,6 @@ class _CupertinoDatePickerDateState extends State { estimatedColumnWidths[_PickerColumnType.month.index]!, ]; break; - default: - assert(false, 'date order is not specified'); } final List pickers = []; diff --git a/packages/flutter/lib/src/cupertino/nav_bar.dart b/packages/flutter/lib/src/cupertino/nav_bar.dart index f3d08676e1..f108e49229 100644 --- a/packages/flutter/lib/src/cupertino/nav_bar.dart +++ b/packages/flutter/lib/src/cupertino/nav_bar.dart @@ -102,7 +102,6 @@ Widget _wrapWithBackground({ overlayStyle = SystemUiOverlayStyle.light; break; case Brightness.light: - default: overlayStyle = SystemUiOverlayStyle.dark; break; } diff --git a/packages/flutter/lib/src/cupertino/refresh.dart b/packages/flutter/lib/src/cupertino/refresh.dart index d4ba781a99..f656801458 100644 --- a/packages/flutter/lib/src/cupertino/refresh.dart +++ b/packages/flutter/lib/src/cupertino/refresh.dart @@ -467,7 +467,7 @@ class CupertinoSliverRefreshControl extends StatefulWidget { case RefreshIndicatorMode.done: // When the user lets go, the standard transition is to shrink the spinner. return CupertinoActivityIndicator(radius: radius * percentageComplete); - default: + case RefreshIndicatorMode.inactive: // Anything else doesn't show anything. return Container(); } diff --git a/packages/flutter/lib/src/cupertino/text_selection.dart b/packages/flutter/lib/src/cupertino/text_selection.dart index 2575f1b7d8..90e51e6327 100644 --- a/packages/flutter/lib/src/cupertino/text_selection.dart +++ b/packages/flutter/lib/src/cupertino/text_selection.dart @@ -556,7 +556,7 @@ class _CupertinoTextSelectionControls extends TextSelectionControls { handleSize.height - 2 * _kSelectionHandleRadius + _kSelectionHandleOverlap, ); // A collapsed handle anchors itself so that it's centered. - default: + case TextSelectionHandleType.collapsed: return Offset( handleSize.width / 2, textLineHeight + (handleSize.height - textLineHeight) / 2, diff --git a/packages/flutter/lib/src/gestures/converter.dart b/packages/flutter/lib/src/gestures/converter.dart index 5f4cead42f..d79922c3fd 100644 --- a/packages/flutter/lib/src/gestures/converter.dart +++ b/packages/flutter/lib/src/gestures/converter.dart @@ -20,7 +20,7 @@ int _synthesiseDownButtons(int buttons, PointerDeviceKind kind) { case PointerDeviceKind.stylus: case PointerDeviceKind.invertedStylus: return buttons | kPrimaryButton; - default: + case PointerDeviceKind.unknown: // We have no information about the device but we know we never want // buttons to be 0 when the pointer is down. return buttons == 0 ? kPrimaryButton : buttons; diff --git a/packages/flutter/lib/src/material/about.dart b/packages/flutter/lib/src/material/about.dart index fa2ee6e323..648df10158 100644 --- a/packages/flutter/lib/src/material/about.dart +++ b/packages/flutter/lib/src/material/about.dart @@ -1282,7 +1282,6 @@ class _MasterDetailFlowState extends State<_MasterDetailFlow> implements _PageOp case _LayoutMode.lateral: return _lateralUI(context); case _LayoutMode.auto: - default: return LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { final double availableWidth = constraints.maxWidth; @@ -1310,7 +1309,6 @@ class _MasterDetailFlowState extends State<_MasterDetailFlow> implements _PageOp case _Focus.master: return >[masterPageRoute]; case _Focus.detail: - default: return >[ masterPageRoute, _detailPageRoute(_cachedDetailArguments) diff --git a/packages/flutter/lib/src/material/pickers/calendar_date_range_picker.dart b/packages/flutter/lib/src/material/pickers/calendar_date_range_picker.dart index f3ad643526..f92f45c5b7 100644 --- a/packages/flutter/lib/src/material/pickers/calendar_date_range_picker.dart +++ b/packages/flutter/lib/src/material/pickers/calendar_date_range_picker.dart @@ -989,7 +989,7 @@ class _HighlightPainter extends CustomPainter { paint, ); break; - default: + case _HighlightPainterStyle.none: break; } } diff --git a/packages/flutter/lib/src/material/reorderable_list.dart b/packages/flutter/lib/src/material/reorderable_list.dart index bbb8374feb..d20c693eea 100644 --- a/packages/flutter/lib/src/material/reorderable_list.dart +++ b/packages/flutter/lib/src/material/reorderable_list.dart @@ -255,7 +255,6 @@ class _ReorderableListContentState extends State<_ReorderableListContent> with T dropAreaWithoutMargin = _draggingFeedbackSize!.width; break; case Axis.vertical: - default: dropAreaWithoutMargin = _draggingFeedbackSize!.height; break; } @@ -349,7 +348,6 @@ class _ReorderableListContentState extends State<_ReorderableListContent> with T case Axis.horizontal: return Row(children: children); case Axis.vertical: - default: return Column(children: children); } } @@ -494,7 +492,6 @@ class _ReorderableListContentState extends State<_ReorderableListContent> with T spacing = SizedBox(width: _dropAreaExtent); break; case Axis.vertical: - default: spacing = SizedBox(height: _dropAreaExtent); break; } @@ -561,7 +558,6 @@ class _ReorderableListContentState extends State<_ReorderableListContent> with T ); break; case Axis.vertical: - default: finalDropArea = SizedBox( key: endWidgetKey, height: _defaultDropAreaExtent, diff --git a/packages/flutter/lib/src/services/raw_keyboard_web.dart b/packages/flutter/lib/src/services/raw_keyboard_web.dart index 3e0edde068..d44d9c99b1 100644 --- a/packages/flutter/lib/src/services/raw_keyboard_web.dart +++ b/packages/flutter/lib/src/services/raw_keyboard_web.dart @@ -110,7 +110,6 @@ class RawKeyEventDataWeb extends RawKeyEventData { return metaState & modifierScrollLock != 0; case ModifierKey.functionModifier: case ModifierKey.symbolModifier: - default: // On Web, the browser doesn't report the state of the FN and SYM modifiers. return false; } diff --git a/packages/flutter/lib/src/widgets/interactive_viewer.dart b/packages/flutter/lib/src/widgets/interactive_viewer.dart index cc410755ab..ae2c1eae92 100644 --- a/packages/flutter/lib/src/widgets/interactive_viewer.dart +++ b/packages/flutter/lib/src/widgets/interactive_viewer.dart @@ -710,7 +710,7 @@ class _InteractiveViewerState extends State with TickerProvid return widget.scaleEnabled; case _GestureType.pan: - default: + case null: return widget.panEnabled; } } @@ -1238,7 +1238,6 @@ Offset _alignAxis(Offset offset, Axis axis) { case Axis.horizontal: return Offset(offset.dx, 0.0); case Axis.vertical: - default: return Offset(0.0, offset.dy); } } diff --git a/packages/flutter/test/widgets/dismissible_test.dart b/packages/flutter/test/widgets/dismissible_test.dart index cc5401715f..1589ad9490 100644 --- a/packages/flutter/test/widgets/dismissible_test.dart +++ b/packages/flutter/test/widgets/dismissible_test.dart @@ -99,8 +99,6 @@ Future dismissElement(WidgetTester tester, Finder finder, { required AxisD downLocation = tester.getTopLeft(finder) + const Offset(0.1, 0.0); upLocation = tester.getBottomLeft(finder); break; - default: - fail('unsupported gestureDirection'); } final TestGesture gesture = await tester.startGesture(downLocation); @@ -123,8 +121,6 @@ Future flingElement(WidgetTester tester, Finder finder, { required AxisDir case AxisDirection.down: delta = const Offset(0.0, 300.0); break; - default: - fail('unsupported gestureDirection'); } await tester.fling(finder, delta, 1000.0, initialOffset: delta * initialOffsetFactor); } diff --git a/packages/flutter/test/widgets/editable_text_test.dart b/packages/flutter/test/widgets/editable_text_test.dart index 7defd6cd7e..5d74682eb3 100644 --- a/packages/flutter/test/widgets/editable_text_test.dart +++ b/packages/flutter/test/widgets/editable_text_test.dart @@ -3643,8 +3643,6 @@ void main() { ), ); break; - default: - throw TestFailure("HandlePositionInViewport can't be null."); } } expect(state.selectionOverlay!.handlesAreVisible, isTrue); @@ -4488,8 +4486,6 @@ void main() { ), ); break; - default: - throw TestFailure("HandlePositionInViewport can't be null."); } } expect(state.selectionOverlay!.handlesAreVisible, isTrue); diff --git a/packages/flutter_tools/lib/src/commands/attach.dart b/packages/flutter_tools/lib/src/commands/attach.dart index 66ccd25669..853f42131c 100644 --- a/packages/flutter_tools/lib/src/commands/attach.dart +++ b/packages/flutter_tools/lib/src/commands/attach.dart @@ -110,20 +110,21 @@ class AttachCommand extends FlutterCommand { final String name = 'attach'; @override - final String description = '''Attach to a running app. + final String description = ''' +Attach to a running app. - For attaching to Android or iOS devices, simply using `flutter attach` is - usually sufficient. The tool will search for a running Flutter app or module, - if available. Otherwise, the tool will wait for the next Flutter app or module - to launch before attaching. +For attaching to Android or iOS devices, simply using `flutter attach` is +usually sufficient. The tool will search for a running Flutter app or module, +if available. Otherwise, the tool will wait for the next Flutter app or module +to launch before attaching. - For Fuchsia, the module name must be provided, e.g. `\$flutter attach - --module=mod_name`. This can be called either before or after the application - is started. +For Fuchsia, the module name must be provided, e.g. `\$flutter attach +--module=mod_name`. This can be called either before or after the application +is started. - If the app or module is already running and the specific observatory port is - known, it can be explicitly provided to attach via the command-line, e.g. - `\$ flutter attach --debug-port 12345`'''; +If the app or module is already running and the specific observatory port is +known, it can be explicitly provided to attach via the command-line, e.g. +`\$ flutter attach --debug-port 12345`'''; int get debugPort { if (argResults['debug-port'] == null) { diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart index 7125311a57..b474a078d4 100644 --- a/packages/flutter_tools/lib/src/commands/create.dart +++ b/packages/flutter_tools/lib/src/commands/create.dart @@ -1013,16 +1013,14 @@ String _validateProjectDir(String dirPath, { String flutterRoot, bool overwrite final FileSystemEntityType type = globals.fs.typeSync(dirPath); - if (type != FileSystemEntityType.notFound) { - switch (type) { - case FileSystemEntityType.file: - // Do not overwrite files. - return "Invalid project name: '$dirPath' - file exists."; - case FileSystemEntityType.link: - // Do not overwrite links. - return "Invalid project name: '$dirPath' - refers to a link."; - } + switch (type) { + case FileSystemEntityType.file: + // Do not overwrite files. + return "Invalid project name: '$dirPath' - file exists."; + case FileSystemEntityType.link: + // Do not overwrite links. + return "Invalid project name: '$dirPath' - refers to a link."; + default: + return null; } - - return null; } diff --git a/packages/flutter_tools/lib/src/commands/ide_config.dart b/packages/flutter_tools/lib/src/commands/ide_config.dart index b18491222e..4f229454ff 100644 --- a/packages/flutter_tools/lib/src/commands/ide_config.dart +++ b/packages/flutter_tools/lib/src/commands/ide_config.dart @@ -268,13 +268,11 @@ class IdeConfigCommand extends FlutterCommand { String _validateFlutterDir(String dirPath, { String flutterRoot }) { final FileSystemEntityType type = globals.fs.typeSync(dirPath); - if (type != FileSystemEntityType.notFound) { - switch (type) { - case FileSystemEntityType.link: - // Do not overwrite links. - return "Invalid project root dir: '$dirPath' - refers to a link."; - } + switch (type) { + case FileSystemEntityType.link: + // Do not overwrite links. + return "Invalid project root dir: '$dirPath' - refers to a link."; + default: + return null; } - - return null; } diff --git a/packages/flutter_tools/lib/src/localizations/gen_l10n_templates.dart b/packages/flutter_tools/lib/src/localizations/gen_l10n_templates.dart index cfef475af1..1302fbf8b2 100644 --- a/packages/flutter_tools/lib/src/localizations/gen_l10n_templates.dart +++ b/packages/flutter_tools/lib/src/localizations/gen_l10n_templates.dart @@ -223,30 +223,34 @@ Future<@(class)> @(lookupName)(Locale locale) { return null; }'''; -const String lookupBodyTemplate = '''@(lookupAllCodesSpecified) - @(lookupScriptCodeSpecified) - @(lookupCountryCodeSpecified) - @(lookupLanguageCodeSpecified)'''; +const String lookupBodyTemplate = ''' +@(lookupAllCodesSpecified) +@(lookupScriptCodeSpecified) +@(lookupCountryCodeSpecified) +@(lookupLanguageCodeSpecified)'''; const String switchClauseTemplate = '''case '@(case)': return @(localeClass)();'''; const String switchClauseDeferredLoadingTemplate = '''case '@(case)': return @(library).loadLibrary().then((dynamic _) => @(library).@(localeClass)());'''; -const String nestedSwitchTemplate = '''case '@(languageCode)': { - switch (locale.@(code)) { - @(switchClauses) - } - break; - }'''; - -const String languageCodeSwitchTemplate = '''@(comment) - switch (locale.languageCode) { +const String nestedSwitchTemplate = ''' +case '@(languageCode)': { + switch (locale.@(code)) { @(switchClauses) } + break; +}'''; + +const String languageCodeSwitchTemplate = ''' +@(comment) +switch (locale.languageCode) { + @(switchClauses) +} '''; -const String allCodesLookupTemplate = '''// Lookup logic when language+script+country codes are specified. - switch (locale.toString()) { - @(allCodesSwitchClauses) - } +const String allCodesLookupTemplate = ''' +// Lookup logic when language+script+country codes are specified. +switch (locale.toString()) { + @(allCodesSwitchClauses) +} '''; diff --git a/packages/flutter_tools/lib/src/localizations/language_subtag_registry.dart b/packages/flutter_tools/lib/src/localizations/language_subtag_registry.dart index 278b62a41d..6372d6dfca 100644 --- a/packages/flutter_tools/lib/src/localizations/language_subtag_registry.dart +++ b/packages/flutter_tools/lib/src/localizations/language_subtag_registry.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. /// Cache of https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry. -const String languageSubtagRegistry = '''File-Date: 2020-03-16 +const String languageSubtagRegistry = ''' +File-Date: 2020-03-16 %% Type: language Subtag: aa diff --git a/packages/flutter_tools/lib/src/web/bootstrap.dart b/packages/flutter_tools/lib/src/web/bootstrap.dart index 4e9869d80c..2c3ec19e9c 100644 --- a/packages/flutter_tools/lib/src/web/bootstrap.dart +++ b/packages/flutter_tools/lib/src/web/bootstrap.dart @@ -53,7 +53,8 @@ String generateMainModule({ @required bool nullAssertions, }) { // TODO(jonahwilliams): fix typo in dwds and update. - return '''/* ENTRYPOINT_EXTENTION_MARKER */ + return ''' +/* ENTRYPOINT_EXTENTION_MARKER */ // Create the main module loaded below. define("main_module.bootstrap", ["$entrypoint", "dart_sdk"], function(app, dart_sdk) { dart_sdk.dart.setStartAsyncSynchronously(true); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart index 2d1e8119d3..ccd62a1934 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart @@ -382,14 +382,15 @@ set(BINARY_NAME "fizz_bar") ninjaCommand('release', onRun: () { fileSystem.file('build/flutter_size_01/snapshot.linux-x64.json') ..createSync(recursive: true) - ..writeAsStringSync('''[ -{ - "l": "dart:_internal", - "c": "SubListIterable", - "n": "[Optimized] skip", - "s": 2400 -} - ]'''); + ..writeAsStringSync(''' +[ + { + "l": "dart:_internal", + "c": "SubListIterable", + "n": "[Optimized] skip", + "s": 2400 + } +]'''); fileSystem.file('build/flutter_size_01/trace.linux-x64.json') ..createSync(recursive: true) ..writeAsStringSync('{}'); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart index 64f3adc812..87479ed04b 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart @@ -347,14 +347,15 @@ void main() { setUpMockXcodeBuildHandler('Release', onRun: () { fileSystem.file('build/flutter_size_01/snapshot.x86_64.json') ..createSync(recursive: true) - ..writeAsStringSync('''[ -{ - "l": "dart:_internal", - "c": "SubListIterable", - "n": "[Optimized] skip", - "s": 2400 -} - ]'''); + ..writeAsStringSync(''' +[ + { + "l": "dart:_internal", + "c": "SubListIterable", + "n": "[Optimized] skip", + "s": 2400 + } +]'''); fileSystem.file('build/flutter_size_01/trace.x86_64.json') ..createSync(recursive: true) ..writeAsStringSync('{}'); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart index 02b3a9cc6f..b2b854dd3d 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart @@ -195,7 +195,8 @@ void main() { // edited down for compactness. For instance, where similar lines are // repeated in actual output, one or two representative lines are chosen // to be included here. - const String stdout = r'''Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework + const String stdout = r''' +Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved. Checking Build System @@ -227,7 +228,8 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier const ['windows', '--no-pub'] ); // Just the warnings and errors should be surfaced. - expect(testLogger.errorText, r'''C:\foo\windows\runner\main.cpp(18): error C2220: the following warning is treated as an error [C:\foo\build\windows\runner\test.vcxproj] + expect(testLogger.errorText, r''' +C:\foo\windows\runner\main.cpp(18): error C2220: the following warning is treated as an error [C:\foo\build\windows\runner\test.vcxproj] C:\foo\windows\runner\main.cpp(18): warning C4706: assignment within conditional expression [C:\foo\build\windows\runner\test.vcxproj] main.obj : error LNK2019: unresolved external symbol "void __cdecl Bar(void)" (?Bar@@YAXXZ) referenced in function wWinMain [C:\foo\build\windows\runner\test.vcxproj] C:\foo\build\windows\runner\Debug\test.exe : fatal error LNK1120: 1 unresolved externals [C:\foo\build\windows\runner\test.vcxproj] @@ -381,14 +383,15 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier buildCommand('Release', onRun: () { fileSystem.file(r'build\flutter_size_01\snapshot.windows-x64.json') ..createSync(recursive: true) - ..writeAsStringSync('''[ -{ - "l": "dart:_internal", - "c": "SubListIterable", - "n": "[Optimized] skip", - "s": 2400 -} - ]'''); + ..writeAsStringSync(''' +[ + { + "l": "dart:_internal", + "c": "SubListIterable", + "n": "[Optimized] skip", + "s": 2400 + } +]'''); fileSystem.file(r'build\flutter_size_01\trace.windows-x64.json') ..createSync(recursive: true) ..writeAsStringSync('{}'); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_xcarchive_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_xcarchive_test.dart index a7cf0f3820..50a636c22f 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_xcarchive_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_xcarchive_test.dart @@ -204,14 +204,15 @@ void main() { setUpMockXcodeBuildHandler(onRun: () { fileSystem.file('build/flutter_size_01/snapshot.arm64.json') ..createSync(recursive: true) - ..writeAsStringSync('''[ -{ - "l": "dart:_internal", - "c": "SubListIterable", - "n": "[Optimized] skip", - "s": 2400 -} - ]'''); + ..writeAsStringSync(''' +[ + { + "l": "dart:_internal", + "c": "SubListIterable", + "n": "[Optimized] skip", + "s": 2400 + } +]'''); fileSystem.file('build/flutter_size_01/trace.arm64.json') ..createSync(recursive: true) ..writeAsStringSync('{}'); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/generate_localizations_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/generate_localizations_test.dart index 84e2964032..9cf1e4beaa 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/generate_localizations_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/generate_localizations_test.dart @@ -16,7 +16,8 @@ void main() { final MemoryFileSystem fileSystem = MemoryFileSystem.test(); final File arbFile = fileSystem.file(fileSystem.path.join('lib', 'l10n', 'app_en.arb')) ..createSync(recursive: true); - arbFile.writeAsStringSync('''{ + arbFile.writeAsStringSync(''' +{ "helloWorld": "Hello, World!", "@helloWorld": { "description": "Sample description" @@ -52,7 +53,8 @@ void main() { 'app_en.arb', )..createSync(recursive: true); - arbFile.writeAsStringSync('''{ + arbFile.writeAsStringSync(''' +{ "helloWorld": "Hello, World!", "@helloWorld": { "description": "Sample description" @@ -85,7 +87,8 @@ void main() { final MemoryFileSystem fileSystem = MemoryFileSystem.test(); final File arbFile = fileSystem.file(fileSystem.path.join('lib', 'l10n', 'app_en.arb')) ..createSync(recursive: true); - arbFile.writeAsStringSync('''{ + arbFile.writeAsStringSync(''' +{ "helloWorld": "Hello, World!", "@helloWorld": { "description": "Sample description" diff --git a/packages/flutter_tools/test/commands.shard/permeable/analyze_once_test.dart b/packages/flutter_tools/test/commands.shard/permeable/analyze_once_test.dart index 22c3d4d787..e6e135b383 100644 --- a/packages/flutter_tools/test/commands.shard/permeable/analyze_once_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/analyze_once_test.dart @@ -75,7 +75,8 @@ void main() { } else { flutterRootUri.write(canonicalizedFlutterRootPath); } - final String dotPackagesSrc = '''# Generated + final String dotPackagesSrc = ''' +# Generated flutter:$flutterRootUri/packages/flutter/lib/ sky_engine:$flutterRootUri/bin/cache/pkg/sky_engine/lib/ flutter_project:lib/ diff --git a/packages/flutter_tools/test/general.shard/android/gradle_test.dart b/packages/flutter_tools/test/general.shard/android/gradle_test.dart index dc21c3b002..0ad0805e2d 100644 --- a/packages/flutter_tools/test/general.shard/android/gradle_test.dart +++ b/packages/flutter_tools/test/general.shard/android/gradle_test.dart @@ -1457,13 +1457,14 @@ plugin1=${plugin1.path} fileSystem.file('foo/snapshot.arm64-v8a.json') ..createSync(recursive: true) - ..writeAsStringSync(r'''[ -{ - "l": "dart:_internal", - "c": "SubListIterable", - "n": "[Optimized] skip", - "s": 2400 -} + ..writeAsStringSync(r''' +[ + { + "l": "dart:_internal", + "c": "SubListIterable", + "n": "[Optimized] skip", + "s": 2400 + } ]'''); fileSystem.file('foo/trace.arm64-v8a.json') ..createSync(recursive: true) diff --git a/packages/flutter_tools/test/general.shard/base/analyze_size_test.dart b/packages/flutter_tools/test/general.shard/base/analyze_size_test.dart index f9b9af3db3..e09dfb7194 100644 --- a/packages/flutter_tools/test/general.shard/base/analyze_size_test.dart +++ b/packages/flutter_tools/test/general.shard/base/analyze_size_test.dart @@ -12,7 +12,8 @@ import 'package:mockito/mockito.dart'; import '../../src/common.dart'; -const String aotSizeOutput = '''[ +const String aotSizeOutput = ''' +[ { "l": "dart:_internal", "c": "SubListIterable", diff --git a/packages/flutter_tools/test/general.shard/resident_runner_test.dart b/packages/flutter_tools/test/general.shard/resident_runner_test.dart index 887c238f59..96891cfcb0 100644 --- a/packages/flutter_tools/test/general.shard/resident_runner_test.dart +++ b/packages/flutter_tools/test/general.shard/resident_runner_test.dart @@ -1319,7 +1319,8 @@ void main() { testUsingContext('ResidentRunner can run source generation', () => testbed.run(() async { final File arbFile = globals.fs.file(globals.fs.path.join('lib', 'l10n', 'app_en.arb')) ..createSync(recursive: true); - arbFile.writeAsStringSync('''{ + arbFile.writeAsStringSync(''' +{ "helloWorld": "Hello, World!", "@helloWorld": { "description": "Sample description" @@ -1339,7 +1340,8 @@ void main() { // to app_en.arb. final File arbFile = globals.fs.file(globals.fs.path.join('lib', 'l10n', 'foo.arb')) ..createSync(recursive: true); - arbFile.writeAsStringSync('''{ + arbFile.writeAsStringSync(''' +{ "helloWorld": "Hello, World!", "@helloWorld": { "description": "Sample description" diff --git a/packages/flutter_tools/test/general.shard/web/bootstrap_test.dart b/packages/flutter_tools/test/general.shard/web/bootstrap_test.dart index 00e56b6648..8379f5a4fe 100644 --- a/packages/flutter_tools/test/general.shard/web/bootstrap_test.dart +++ b/packages/flutter_tools/test/general.shard/web/bootstrap_test.dart @@ -36,8 +36,8 @@ void main() { nullAssertions: true, ); - expect(result, contains( -''' if (true) { + expect(result, contains(''' + if (true) { dart_sdk.dart.nonNullAsserts(true);''')); }); }