Skip to content

Commit 39e60fa

Browse files
bkonyiCommit Queue
authored and
Commit Queue
committed
[ package:vm_service ] Enable more lints
Change-Id: I1a7548297fa8562ea81f3d4e32db2aba53661189 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335960 Reviewed-by: Derek Xu <[email protected]> Commit-Queue: Ben Konyi <[email protected]>
1 parent 60b90b2 commit 39e60fa

File tree

198 files changed

+2309
-1474
lines changed

Some content is hidden

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

198 files changed

+2309
-1474
lines changed

pkg/vm_service/test/analysis_options.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ analyzer:
1414

1515
linter:
1616
rules:
17-
# always_declare_return_types: true
18-
# avoid_escaping_inner_quotes: true
19-
# avoid_void_async: true
20-
# cancel_subscriptions: true
21-
# close_sinks: true
17+
always_declare_return_types: true
18+
avoid_escaping_inner_quotes: true
19+
avoid_void_async: true
20+
cancel_subscriptions: true
21+
close_sinks: true
2222
constant_identifier_names: false # Disabled for LINE_N style constants in tests
2323
directives_ordering: true
24-
# no_adjacent_strings_in_list: true
25-
# prefer_final_locals: true
26-
# prefer_void_to_null: true
27-
# require_trailing_commas: true
28-
# unnecessary_parenthesis: true
29-
# unnecessary_raw_strings: true
24+
no_adjacent_strings_in_list: true
25+
prefer_final_locals: true
26+
prefer_void_to_null: true
27+
require_trailing_commas: true
28+
unnecessary_parenthesis: true
29+
unnecessary_raw_strings: true

pkg/vm_service/test/async_generator_breakpoint_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Future testAsync(VmService service, IsolateRef isolateRef) async {
8989
unawaited(
9090
service.evaluate(isolateId, lib.id!, 'testerReady = true').then(
9191
(Response result) async {
92-
Obj res =
92+
final Obj res =
9393
await service.getObject(isolateId, (result as InstanceRef).id!);
9494
print(res);
9595
expect((res as Instance).valueAsString, equals('true'));
@@ -114,7 +114,7 @@ Future testAsync(VmService service, IsolateRef isolateRef) async {
114114

115115
final tests = <IsolateTest>[testAsync];
116116

117-
main([args = const <String>[]]) => runIsolateTests(
117+
void main([args = const <String>[]]) => runIsolateTests(
118118
args,
119119
tests,
120120
'async_generator_breakpoint_test.dart',

pkg/vm_service/test/async_next_regression_18877_test.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ const LINE_B = 34;
2020
const LINE_C = 35;
2121
// AUTOGENERATED END
2222

23-
foo() async {}
23+
Future<void> foo() async {}
2424

25-
doAsync(stop) async {
25+
Future<void> doAsync(stop) async {
2626
// Flutter issue 18877:
2727
// If a closure is defined in the context of an async method, stepping over
2828
// an await causes the implicit breakpoint to be set for that closure instead
@@ -34,10 +34,9 @@ doAsync(stop) async {
3434
await foo(); // LINE_B
3535
await foo(); // LINE_C
3636
baz();
37-
return null;
3837
}
3938

40-
testMain() {
39+
void testMain() {
4140
// With two runs of doAsync floating around, async step should only cause
4241
// us to stop in the run we started in.
4342
doAsync(false);

pkg/vm_service/test/async_next_test.dart

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,36 @@ import 'dart:developer';
77
import 'common/service_test_common.dart';
88
import 'common/test_helper.dart';
99

10-
const int LINE_D = 18;
11-
const int LINE_A = 19;
12-
const int LINE_B = 20;
13-
const int LINE_C = 21;
10+
// AUTOGENERATED START
11+
//
12+
// Update these constants by running:
13+
//
14+
// dart pkg/vm_service/test/update_line_numbers.dart <test.dart>
15+
//
16+
const LINE_D = 25;
17+
const LINE_A = 26;
18+
const LINE_B = 27;
19+
const LINE_C = 28;
20+
// AUTOGENERATED END
1421

15-
foo() async {}
22+
Future<void> foo() async {}
1623

17-
doAsync(stop) async {
18-
if (stop) debugger();
19-
await foo(); // Line A.
20-
await foo(); // Line B.
21-
await foo(); // Line C.
22-
return null;
24+
Future<void> doAsync(bool stop) async {
25+
if (stop) debugger(); // LINE_D
26+
await foo(); // LINE_A
27+
await foo(); // LINE_B
28+
await foo(); // LINE_C
29+
return;
2330
}
2431

25-
testMain() {
32+
void testMain() {
2633
// With two runs of doAsync floating around, async step should only cause
2734
// us to stop in the run we started in.
2835
doAsync(false);
2936
doAsync(true);
3037
}
3138

32-
var tests = <IsolateTest>[
39+
final tests = <IsolateTest>[
3340
hasStoppedAtBreakpoint,
3441
stoppedAtLine(LINE_D),
3542
stepOver, // foo()
@@ -45,7 +52,7 @@ var tests = <IsolateTest>[
4552
resumeIsolate,
4653
];
4754

48-
main([args = const <String>[]]) => runIsolateTests(
55+
void main([args = const <String>[]]) => runIsolateTests(
4956
args,
5057
tests,
5158
'async_next_test.dart',

pkg/vm_service/test/async_scope_test.dart

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,69 +10,81 @@ import 'package:vm_service/vm_service.dart';
1010
import 'common/service_test_common.dart';
1111
import 'common/test_helper.dart';
1212

13-
const int LINE_A = 20;
14-
const int LINE_B = 26;
13+
// AUTOGENERATED START
14+
//
15+
// Update these constants by running:
16+
//
17+
// dart pkg/vm_service/test/update_line_numbers.dart <test.dart>
18+
//
19+
const LINE_A = 28;
20+
const LINE_B = 35;
21+
const LINE_C = 40;
22+
// AUTOGENERATED END
1523

16-
foo() {}
24+
void foo() {}
1725

18-
doAsync(param1) async {
19-
var local1 = param1 + 1;
20-
foo(); // Line A.
26+
Future<void> doAsync(int param1) async {
27+
final local1 = param1 + 1;
28+
foo(); // LINE_A
29+
// ignore: await_only_futures
2130
await local1;
2231
}
2332

24-
doAsyncStar(param2) async* {
25-
var local2 = param2 + 1;
26-
foo(); // Line B.
33+
Stream<int> doAsyncStar(int param2) async* {
34+
final local2 = param2 + 1;
35+
foo(); // LINE_B
2736
yield local2;
2837
}
2938

30-
testeeDo() {
31-
debugger();
39+
void testeeDo() {
40+
debugger(); // LINE_C
3241

3342
doAsync(1).then((_) {
3443
doAsyncStar(1).listen((_) {});
3544
});
3645
}
3746

3847
Future<void> checkAsyncVarDescriptors(
39-
VmService? service, IsolateRef? isolateRef) async {
40-
final isolateId = isolateRef!.id!;
41-
final stack = await service!.getStack(isolateId);
48+
VmService service,
49+
IsolateRef isolateRef,
50+
) async {
51+
final isolateId = isolateRef.id!;
52+
final stack = await service.getStack(isolateId);
4253
expect(stack.frames!.length, greaterThanOrEqualTo(1));
4354
final frame = stack.frames![0];
4455
final vars = frame.vars!.map((v) => v.name).join(' ');
4556
expect(vars, 'param1 local1'); // no :async_op et al
4657
}
4758

4859
Future checkAsyncStarVarDescriptors(
49-
VmService? service, IsolateRef? isolateRef) async {
50-
final isolateId = isolateRef!.id!;
51-
final stack = await service!.getStack(isolateId);
60+
VmService service,
61+
IsolateRef isolateRef,
62+
) async {
63+
final isolateId = isolateRef.id!;
64+
final stack = await service.getStack(isolateId);
5265
expect(stack.frames!.length, greaterThanOrEqualTo(1));
5366
final frame = stack.frames![0];
5467
final vars = frame.vars!.map((v) => v.name).join(' ');
5568
expect(vars, 'param2 local2'); // no :async_op et al
5669
}
5770

58-
var tests = <IsolateTest>[
59-
hasStoppedAtBreakpoint, // debugger()
71+
final tests = <IsolateTest>[
72+
hasStoppedAtBreakpoint,
73+
stoppedAtLine(LINE_C),
6074
setBreakpointAtLine(LINE_A),
6175
setBreakpointAtLine(LINE_B),
6276
resumeIsolate,
63-
6477
hasStoppedAtBreakpoint,
6578
stoppedAtLine(LINE_A),
6679
checkAsyncVarDescriptors,
6780
resumeIsolate,
68-
6981
hasStoppedAtBreakpoint,
7082
stoppedAtLine(LINE_B),
7183
checkAsyncStarVarDescriptors,
7284
resumeIsolate,
7385
];
7486

75-
main([args = const <String>[]]) => runIsolateTests(
87+
Future<void> main([args = const <String>[]]) => runIsolateTests(
7688
args,
7789
tests,
7890
'async_scope_test.dart',

pkg/vm_service/test/async_single_step_exception_test.dart

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,28 @@ import 'dart:developer';
66
import 'common/service_test_common.dart';
77
import 'common/test_helper.dart';
88

9-
const LINE_A = 19;
10-
const LINE_B = 20;
11-
const LINE_0 = 24;
12-
const LINE_C = 25;
13-
const LINE_D = 27;
14-
const LINE_E = 30;
15-
const LINE_F = 33;
16-
const LINE_G = 35;
9+
// AUTOGENERATED START
10+
//
11+
// Update these constants by running:
12+
//
13+
// dart pkg/vm_service/test/update_line_numbers.dart <test.dart>
14+
//
15+
const LINE_A = 26;
16+
const LINE_B = 27;
17+
const LINE_0 = 31;
18+
const LINE_C = 32;
19+
const LINE_D = 34;
20+
const LINE_E = 37;
21+
const LINE_F = 40;
22+
const LINE_G = 42;
23+
// AUTOGENERATED END
1724

18-
helper() async {
25+
Future<Never> helper() async {
1926
print('helper'); // LINE_A.
2027
throw 'a'; // LINE_B.
2128
}
2229

23-
testMain() async {
30+
Future<void> testMain() async {
2431
debugger(); // LINE_0.
2532
print('mmmmm'); // LINE_C.
2633
try {
@@ -35,7 +42,7 @@ testMain() async {
3542
print('z'); // LINE_G.
3643
}
3744

38-
var tests = <IsolateTest>[
45+
final tests = <IsolateTest>[
3946
hasStoppedAtBreakpoint,
4047
stoppedAtLine(LINE_0), // debugger
4148
stepOver,
@@ -73,10 +80,10 @@ var tests = <IsolateTest>[
7380

7481
hasStoppedAtBreakpoint,
7582
stoppedAtLine(LINE_G), // print(z)
76-
resumeIsolate
83+
resumeIsolate,
7784
];
7885

79-
main([args = const <String>[]]) => runIsolateTests(
86+
void main([args = const <String>[]]) => runIsolateTests(
8087
args,
8188
tests,
8289
'async_single_step_exception_test.dart',

pkg/vm_service/test/async_single_step_into_test.dart

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,28 @@ import 'dart:developer';
66
import 'common/service_test_common.dart';
77
import 'common/test_helper.dart';
88

9-
const LINE_A = 16;
10-
const LINE_B = 17;
11-
const LINE_0 = 21;
12-
const LINE_C = 22;
13-
const LINE_D = 23;
14-
15-
helper() async {
9+
// AUTOGENERATED START
10+
//
11+
// Update these constants by running:
12+
//
13+
// dart pkg/vm_service/test/update_line_numbers.dart <test.dart>
14+
//
15+
const LINE_A = 23;
16+
const LINE_B = 24;
17+
const LINE_0 = 28;
18+
const LINE_C = 29;
19+
const LINE_D = 30;
20+
// AUTOGENERATED END
21+
22+
Future<void> helper() async {
1623
print('helper'); // LINE_A.
1724
print('foobar'); // LINE_B.
1825
}
1926

20-
testMain() {
27+
Future<void> testMain() async {
2128
debugger(); // LINE_0.
2229
print('mmmmm'); // LINE_C.
23-
helper(); // LINE_D.
30+
await helper(); // LINE_D.
2431
print('z');
2532
}
2633

@@ -42,10 +49,10 @@ var tests = <IsolateTest>[
4249

4350
hasStoppedAtBreakpoint,
4451
stoppedAtLine(LINE_B),
45-
resumeIsolate
52+
resumeIsolate,
4653
];
4754

48-
main([args = const <String>[]]) => runIsolateTestsSynchronous(
55+
void main([args = const <String>[]]) => runIsolateTests(
4956
args,
5057
tests,
5158
'async_single_step_into_test.dart',

0 commit comments

Comments
 (0)