Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit fdd2d7d

Browse files
authored
Sync analysis_options.yaml & cleanups (#117327)
1 parent 81bc54b commit fdd2d7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+88
-151
lines changed

analysis_options.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,14 @@ linter:
8888
# - cascade_invocations # doesn't match the typical style of this repo
8989
- cast_nullable_to_non_nullable
9090
# - close_sinks # not reliable enough
91+
- collection_methods_unrelated_type
9192
- combinators_ordering
9293
# - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142
9394
- conditional_uri_does_not_exist
9495
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
9596
- control_flow_in_finally
9697
- curly_braces_in_flow_control_structures
98+
# - dangling_library_doc_comments # not yet tested
9799
- depend_on_referenced_packages
98100
- deprecated_consistency
99101
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
@@ -103,15 +105,18 @@ linter:
103105
- empty_catches
104106
- empty_constructor_bodies
105107
- empty_statements
108+
- enable_null_safety
106109
- eol_at_end_of_file
107110
- exhaustive_cases
108111
- file_names
109112
- flutter_style_todos
110113
- hash_and_equals
111114
- implementation_imports
115+
- implicit_call_tearoffs
112116
- iterable_contains_unrelated_type
113117
# - join_return_with_assignment # not required by flutter style
114118
- leading_newlines_in_multiline_strings
119+
# - library_annotations # not yet tested
115120
- library_names
116121
- library_prefixes
117122
- library_private_types_in_public_api
@@ -204,6 +209,7 @@ linter:
204209
- unnecessary_getters_setters
205210
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
206211
- unnecessary_late
212+
- unnecessary_library_directive
207213
- unnecessary_new
208214
- unnecessary_null_aware_assignments
209215
- unnecessary_null_aware_operator_on_extension_on_nullable
@@ -218,6 +224,7 @@ linter:
218224
- unnecessary_string_interpolations
219225
- unnecessary_this
220226
- unnecessary_to_list_in_spreads
227+
- unreachable_from_main
221228
- unrelated_type_equality_checks
222229
- unsafe_html
223230
- use_build_context_synchronously
@@ -235,6 +242,7 @@ linter:
235242
- use_rethrow_when_possible
236243
- use_setters_to_change_properties
237244
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
245+
- use_string_in_part_of_directives
238246
- use_super_parameters
239247
- use_test_throws_matchers
240248
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review

dev/benchmarks/test_apps/stocks/lib/main.dart

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
library stocks;
6-
75
import 'package:flutter/material.dart';
86
import 'package:flutter/rendering.dart' show
97
debugPaintBaselinesEnabled,

dev/bots/analyze_snippet_code.dart

+1
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ class _SnippetChecker {
457457
'// ignore_for_file: directives_ordering',
458458
'// ignore_for_file: prefer_final_locals',
459459
'// ignore_for_file: unnecessary_import',
460+
'// ignore_for_file: unreachable_from_main',
460461
'// ignore_for_file: unused_element',
461462
'// ignore_for_file: unused_local_variable',
462463
];

dev/bots/post_process_docs.dart

-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ import 'package:platform/platform.dart' as platform;
1212

1313
import 'package:process/process.dart';
1414

15-
const String kDocsRoot = 'dev/docs';
16-
const String kPublishRoot = '$kDocsRoot/doc';
17-
1815
class CommandException implements Exception {}
1916

2017
Future<void> main() async {

dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
// @dart = 2.12
66

7-
// This is a dummy dart:ui package for the sample code analyzer tests to use.
8-
7+
/// This is a dummy dart:ui package for the sample code analyzer tests to use.
98
library dart.ui;
109

1110
/// Bla bla bla bla bla bla bla bla bla.

dev/bots/test/analyze_snippet_code_test.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ const List<String> expectedMainErrors = <String>[
3333
];
3434

3535
const List<String> expectedUiErrors = <String>[
36-
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:15:7: (top-level declaration) (prefer_typing_uninitialized_variables)',
37-
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:15:7: (top-level declaration) (missing_const_final_var_or_type)',
38-
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:17:20: (top-level declaration) (prefer_final_fields)',
39-
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:17:20: (top-level declaration) (unused_field)',
36+
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:14:7: (top-level declaration) (prefer_typing_uninitialized_variables)',
37+
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:14:7: (top-level declaration) (missing_const_final_var_or_type)',
38+
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:16:20: (top-level declaration) (prefer_final_fields)',
39+
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:16:20: (top-level declaration) (unused_field)',
4040
];
4141

4242
final RegExp errorPrefixRE = RegExp(r'^([-a-z0-9/_.:]+): .*(\([-a-z_ ]+\) \([-a-z_ ]+\))$');

dev/devicelab/bin/tasks/plugin_test.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ import 'package:flutter_devicelab/tasks/plugin_tests.dart';
77

88
Future<void> main() async {
99
await task(combine(<TaskFunction>[
10-
PluginTest('apk', <String>['-a', 'java', '--platforms=android']),
11-
PluginTest('apk', <String>['-a', 'kotlin', '--platforms=android']),
10+
PluginTest('apk', <String>['-a', 'java', '--platforms=android']).call,
11+
PluginTest('apk', <String>['-a', 'kotlin', '--platforms=android']).call,
1212
// These create the plugins using the new v2 plugin templates but create the
1313
// apps using the old v1 embedding app templates to make sure new plugins
1414
// are by default backward compatible.
1515
PluginTest('apk', <String>['-a', 'java', '--platforms=android'], pluginCreateEnvironment:
16-
<String, String>{'ENABLE_ANDROID_EMBEDDING_V2': 'true'}),
16+
<String, String>{'ENABLE_ANDROID_EMBEDDING_V2': 'true'}).call,
1717
PluginTest('apk', <String>['-a', 'kotlin', '--platforms=android'], pluginCreateEnvironment:
18-
<String, String>{'ENABLE_ANDROID_EMBEDDING_V2': 'true'}),
18+
<String, String>{'ENABLE_ANDROID_EMBEDDING_V2': 'true'}).call,
1919
// Test that Dart-only plugins are supported.
20-
PluginTest('apk', <String>['--platforms=android'], dartOnlyPlugin: true),
20+
PluginTest('apk', <String>['--platforms=android'], dartOnlyPlugin: true).call,
2121
// Test that FFI plugins are supported.
22-
PluginTest('apk', <String>['--platforms=android'], template: 'plugin_ffi'),
22+
PluginTest('apk', <String>['--platforms=android'], template: 'plugin_ffi').call,
2323
]));
2424
}

dev/devicelab/bin/tasks/plugin_test_ios.dart

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import 'package:flutter_devicelab/tasks/plugin_tests.dart';
77

88
Future<void> main() async {
99
await task(combine(<TaskFunction>[
10-
PluginTest('ios', <String>['-i', 'objc', '--platforms=ios']),
11-
PluginTest('ios', <String>['-i', 'swift', '--platforms=ios']),
12-
PluginTest('macos', <String>['--platforms=macos']),
10+
PluginTest('ios', <String>['-i', 'objc', '--platforms=ios']).call,
11+
PluginTest('ios', <String>['-i', 'swift', '--platforms=ios']).call,
12+
PluginTest('macos', <String>['--platforms=macos']).call,
1313
// Test that Dart-only plugins are supported.
14-
PluginTest('ios', <String>['--platforms=ios'], dartOnlyPlugin: true),
15-
PluginTest('macos', <String>['--platforms=macos'], dartOnlyPlugin: true),
14+
PluginTest('ios', <String>['--platforms=ios'], dartOnlyPlugin: true).call,
15+
PluginTest('macos', <String>['--platforms=macos'], dartOnlyPlugin: true).call,
1616
// Test that FFI plugins are supported.
17-
PluginTest('ios', <String>['--platforms=ios'], template: 'plugin_ffi'),
18-
PluginTest('macos', <String>['--platforms=macos'], template: 'plugin_ffi'),
17+
PluginTest('ios', <String>['--platforms=ios'], template: 'plugin_ffi').call,
18+
PluginTest('macos', <String>['--platforms=macos'], template: 'plugin_ffi').call,
1919
]));
2020
}

dev/devicelab/bin/tasks/smoke_test_build_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import 'package:flutter_devicelab/tasks/build_test_task.dart';
1010
/// Smoke test of a successful task.
1111
Future<void> main(List<String> args) async {
1212
deviceOperatingSystem = DeviceOperatingSystem.fake;
13-
await task(FakeBuildTestTask(args));
13+
await task(FakeBuildTestTask(args).call);
1414
}
1515

1616
class FakeBuildTestTask extends BuildTestTask {

dev/devicelab/lib/tasks/gallery.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ final Directory galleryDirectory = dir('${flutterDirectory.path}/dev/integration
1818
///
1919
/// https://github.com/flutter/flutter/issues/103542
2020
TaskFunction createGalleryTransitionBuildTest(List<String> args, {bool semanticsEnabled = false}) {
21-
return GalleryTransitionBuildTest(args, semanticsEnabled: semanticsEnabled);
21+
return GalleryTransitionBuildTest(args, semanticsEnabled: semanticsEnabled).call;
2222
}
2323

2424
TaskFunction createGalleryTransitionTest({bool semanticsEnabled = false}) {
25-
return GalleryTransitionTest(semanticsEnabled: semanticsEnabled);
25+
return GalleryTransitionTest(semanticsEnabled: semanticsEnabled).call;
2626
}
2727

2828
TaskFunction createGalleryTransitionE2EBuildTest(
@@ -39,7 +39,7 @@ TaskFunction createGalleryTransitionE2EBuildTest(
3939
timelineTraceFile: null,
4040
driverFile: 'transitions_perf_e2e_test',
4141
enableImpeller: enableImpeller,
42-
);
42+
).call;
4343
}
4444

4545
TaskFunction createGalleryTransitionE2ETest({
@@ -56,7 +56,7 @@ TaskFunction createGalleryTransitionE2ETest({
5656
timelineTraceFile: null,
5757
driverFile: 'transitions_perf_e2e_test',
5858
enableImpeller: enableImpeller,
59-
);
59+
).call;
6060
}
6161

6262
TaskFunction createGalleryTransitionHybridBuildTest(
@@ -67,7 +67,7 @@ TaskFunction createGalleryTransitionHybridBuildTest(
6767
args,
6868
semanticsEnabled: semanticsEnabled,
6969
driverFile: semanticsEnabled ? 'transitions_perf_hybrid_with_semantics_test' : 'transitions_perf_hybrid_test',
70-
);
70+
).call;
7171
}
7272

7373
TaskFunction createGalleryTransitionHybridTest({bool semanticsEnabled = false}) {
@@ -76,7 +76,7 @@ TaskFunction createGalleryTransitionHybridTest({bool semanticsEnabled = false})
7676
driverFile: semanticsEnabled
7777
? 'transitions_perf_hybrid_with_semantics_test'
7878
: 'transitions_perf_hybrid_test',
79-
);
79+
).call;
8080
}
8181

8282
class GalleryTransitionTest {

dev/devicelab/lib/tasks/integration_tests.dart

+20-20
Original file line numberDiff line numberDiff line change
@@ -11,73 +11,73 @@ TaskFunction createChannelsIntegrationTest() {
1111
return DriverTest(
1212
'${flutterDirectory.path}/dev/integration_tests/channels',
1313
'lib/main.dart',
14-
);
14+
).call;
1515
}
1616

1717
TaskFunction createPlatformInteractionTest() {
1818
return DriverTest(
1919
'${flutterDirectory.path}/dev/integration_tests/platform_interaction',
2020
'lib/main.dart',
21-
);
21+
).call;
2222
}
2323

2424
TaskFunction createFlavorsTest() {
2525
return DriverTest(
2626
'${flutterDirectory.path}/dev/integration_tests/flavors',
2727
'lib/main.dart',
2828
extraOptions: <String>['--flavor', 'paid'],
29-
);
29+
).call;
3030
}
3131

3232
TaskFunction createIntegrationTestFlavorsTest() {
3333
return IntegrationTest(
3434
'${flutterDirectory.path}/dev/integration_tests/flavors',
3535
'integration_test/integration_test.dart',
3636
extraOptions: <String>['--flavor', 'paid'],
37-
);
37+
).call;
3838
}
3939

4040
TaskFunction createExternalUiIntegrationTest() {
4141
return DriverTest(
4242
'${flutterDirectory.path}/dev/integration_tests/external_ui',
4343
'lib/main.dart',
44-
);
44+
).call;
4545
}
4646

4747
TaskFunction createPlatformChannelSampleTest({String? deviceIdOverride}) {
4848
return DriverTest(
4949
'${flutterDirectory.path}/examples/platform_channel',
5050
'test_driver/button_tap.dart',
5151
deviceIdOverride: deviceIdOverride,
52-
);
52+
).call;
5353
}
5454

5555
TaskFunction createPlatformChannelSwiftSampleTest() {
5656
return DriverTest(
5757
'${flutterDirectory.path}/examples/platform_channel_swift',
5858
'test_driver/button_tap.dart',
59-
);
59+
).call;
6060
}
6161

6262
TaskFunction createEmbeddedAndroidViewsIntegrationTest() {
6363
return DriverTest(
6464
'${flutterDirectory.path}/dev/integration_tests/android_views',
6565
'lib/main.dart',
66-
);
66+
).call;
6767
}
6868

6969
TaskFunction createHybridAndroidViewsIntegrationTest() {
7070
return DriverTest(
7171
'${flutterDirectory.path}/dev/integration_tests/hybrid_android_views',
7272
'lib/main.dart',
73-
);
73+
).call;
7474
}
7575

7676
TaskFunction createAndroidSemanticsIntegrationTest() {
7777
return DriverTest(
7878
'${flutterDirectory.path}/dev/integration_tests/android_semantics_testing',
7979
'lib/main.dart',
80-
);
80+
).call;
8181
}
8282

8383
TaskFunction createIOSPlatformViewTests() {
@@ -87,42 +87,42 @@ TaskFunction createIOSPlatformViewTests() {
8787
extraOptions: <String>[
8888
'--dart-define=ENABLE_DRIVER_EXTENSION=true',
8989
],
90-
);
90+
).call;
9191
}
9292

9393
TaskFunction createEndToEndKeyboardTest() {
9494
return DriverTest(
9595
'${flutterDirectory.path}/dev/integration_tests/ui',
9696
'lib/keyboard_resize.dart',
97-
);
97+
).call;
9898
}
9999

100100
TaskFunction createEndToEndFrameNumberTest() {
101101
return DriverTest(
102102
'${flutterDirectory.path}/dev/integration_tests/ui',
103103
'lib/frame_number.dart',
104-
);
104+
).call;
105105
}
106106

107107
TaskFunction createEndToEndDriverTest() {
108108
return DriverTest(
109109
'${flutterDirectory.path}/dev/integration_tests/ui',
110110
'lib/driver.dart',
111-
);
111+
).call;
112112
}
113113

114114
TaskFunction createEndToEndScreenshotTest() {
115115
return DriverTest(
116116
'${flutterDirectory.path}/dev/integration_tests/ui',
117117
'lib/screenshot.dart',
118-
);
118+
).call;
119119
}
120120

121121
TaskFunction createEndToEndKeyboardTextfieldTest() {
122122
return DriverTest(
123123
'${flutterDirectory.path}/dev/integration_tests/ui',
124124
'lib/keyboard_textfield.dart',
125-
);
125+
).call;
126126
}
127127

128128
TaskFunction dartDefinesTask() {
@@ -132,29 +132,29 @@ TaskFunction dartDefinesTask() {
132132
'--dart-define=test.valueA=Example,A',
133133
'--dart-define=test.valueB=Value',
134134
],
135-
);
135+
).call;
136136
}
137137

138138
TaskFunction createEndToEndIntegrationTest() {
139139
return IntegrationTest(
140140
'${flutterDirectory.path}/dev/integration_tests/ui',
141141
'integration_test/integration_test.dart',
142-
);
142+
).call;
143143
}
144144

145145
TaskFunction createSpellCheckIntegrationTest() {
146146
return IntegrationTest(
147147
'${flutterDirectory.path}/dev/integration_tests/spell_check',
148148
'integration_test/integration_test.dart',
149-
);
149+
).call;
150150
}
151151

152152
TaskFunction createWindowsStartupDriverTest({String? deviceIdOverride}) {
153153
return DriverTest(
154154
'${flutterDirectory.path}/dev/integration_tests/windows_startup_test',
155155
'lib/main.dart',
156156
deviceIdOverride: deviceIdOverride,
157-
);
157+
).call;
158158
}
159159

160160
class DriverTest {

0 commit comments

Comments
 (0)