Add missing trailing commas (#28673)
* add trailing commas on list/map/parameters * add trailing commas on Invocation with nb of arg>1 * add commas for widget containing widgets * add trailing commas if instantiation contains trailing comma * revert bad change
This commit is contained in:
committed by
GitHub
parent
046f960ae2
commit
387f885481
@@ -20,11 +20,11 @@ class EnumIndex<E> {
|
||||
EnumIndex(List<E> enumValues)
|
||||
: _nameToValue = Map<String, E>.fromIterable(
|
||||
enumValues,
|
||||
key: _getSimpleName
|
||||
key: _getSimpleName,
|
||||
),
|
||||
_valueToName = Map<E, String>.fromIterable(
|
||||
enumValues,
|
||||
value: _getSimpleName
|
||||
value: _getSimpleName,
|
||||
);
|
||||
|
||||
final Map<String, E> _nameToValue;
|
||||
|
||||
@@ -32,6 +32,6 @@ class RenderTree extends Result {
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'tree': tree
|
||||
'tree': tree,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ class FlutterDriver {
|
||||
message: 'Flutter Driver extension is taking a long time to become available. '
|
||||
'Ensure your test app (often "lib/main.dart") imports '
|
||||
'"package:flutter_driver/driver_extension.dart" and '
|
||||
'calls enableFlutterDriverExtension() as the first call in main().'
|
||||
'calls enableFlutterDriverExtension() as the first call in main().',
|
||||
);
|
||||
} else if (isolate.pauseEvent is VMPauseExitEvent ||
|
||||
isolate.pauseEvent is VMPauseBreakpointEvent ||
|
||||
@@ -725,7 +725,7 @@ class FlutterDriver {
|
||||
try {
|
||||
await _warnIfSlow<void>(
|
||||
future: _peer.sendRequest(_setVMTimelineFlagsMethodName, <String, String>{
|
||||
'recordedStreams': _timelineStreamsToString(streams)
|
||||
'recordedStreams': _timelineStreamsToString(streams),
|
||||
}),
|
||||
timeout: timeout,
|
||||
message: 'VM is taking an unusually long time to respond to being told to start tracing...',
|
||||
@@ -797,7 +797,7 @@ class FlutterDriver {
|
||||
/// operation exceeds the specified timeout; it does not actually cancel the
|
||||
/// operation.
|
||||
Future<void> clearTimeline({
|
||||
Duration timeout = _kUnusuallyLongTimeout
|
||||
Duration timeout = _kUnusuallyLongTimeout,
|
||||
}) async {
|
||||
assert(timeout != null);
|
||||
try {
|
||||
|
||||
@@ -42,7 +42,7 @@ class TimelineEvent {
|
||||
: null,
|
||||
json['ts'],
|
||||
json['tts'],
|
||||
json['args']
|
||||
json['args'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class TimelineEvent {
|
||||
this.threadDuration,
|
||||
this.timestampMicros,
|
||||
this.threadTimestampMicros,
|
||||
this.arguments
|
||||
this.arguments,
|
||||
);
|
||||
|
||||
/// The original event JSON.
|
||||
|
||||
@@ -150,7 +150,7 @@ void main() {
|
||||
'timeout': _kSerializedTestTimeout,
|
||||
'finderType': 'ByValueKey',
|
||||
'keyValueString': 'foo',
|
||||
'keyValueType': 'String'
|
||||
'keyValueType': 'String',
|
||||
});
|
||||
return makeMockResponse(<String, dynamic>{});
|
||||
});
|
||||
@@ -189,10 +189,10 @@ void main() {
|
||||
'timeout': _kSerializedTestTimeout,
|
||||
'finderType': 'ByValueKey',
|
||||
'keyValueString': '123',
|
||||
'keyValueType': 'int'
|
||||
'keyValueType': 'int',
|
||||
});
|
||||
return makeMockResponse(<String, String>{
|
||||
'text': 'hello'
|
||||
'text': 'hello',
|
||||
});
|
||||
});
|
||||
final String result = await driver.getText(find.byValueKey(123), timeout: _kTestTimeout);
|
||||
@@ -274,8 +274,8 @@ void main() {
|
||||
return <String, dynamic> {
|
||||
'traceEvents': <dynamic>[
|
||||
<String, String>{
|
||||
'name': 'test event'
|
||||
}
|
||||
'name': 'test event',
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
@@ -333,8 +333,8 @@ void main() {
|
||||
return <String, dynamic> {
|
||||
'traceEvents': <dynamic>[
|
||||
<String, String>{
|
||||
'name': 'test event'
|
||||
}
|
||||
'name': 'test event',
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
@@ -345,7 +345,7 @@ void main() {
|
||||
streams: const <TimelineStream>[
|
||||
TimelineStream.dart,
|
||||
TimelineStream.gc,
|
||||
TimelineStream.compiler
|
||||
TimelineStream.compiler,
|
||||
],
|
||||
retainPriorEvents: true);
|
||||
|
||||
@@ -376,7 +376,7 @@ void main() {
|
||||
test('remote error', () async {
|
||||
when(mockIsolate.invokeExtension(any, any)).thenAnswer((Invocation i) {
|
||||
return makeMockResponse(<String, dynamic>{
|
||||
'message': 'This is a failure'
|
||||
'message': 'This is a failure',
|
||||
}, isError: true);
|
||||
});
|
||||
try {
|
||||
@@ -432,7 +432,7 @@ Future<Map<String, dynamic>> makeMockResponse(
|
||||
}) {
|
||||
return Future<Map<String, dynamic>>.value(<String, dynamic>{
|
||||
'isError': isError,
|
||||
'response': response
|
||||
'response': response,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -21,15 +21,15 @@ void main() {
|
||||
}
|
||||
|
||||
Map<String, dynamic> build(int timeStamp, int duration) => <String, dynamic>{
|
||||
'name': 'Frame', 'ph': 'X', 'ts': timeStamp, 'dur': duration
|
||||
'name': 'Frame', 'ph': 'X', 'ts': timeStamp, 'dur': duration,
|
||||
};
|
||||
|
||||
Map<String, dynamic> begin(int timeStamp) => <String, dynamic>{
|
||||
'name': 'GPURasterizer::Draw', 'ph': 'B', 'ts': timeStamp
|
||||
'name': 'GPURasterizer::Draw', 'ph': 'B', 'ts': timeStamp,
|
||||
};
|
||||
|
||||
Map<String, dynamic> end(int timeStamp) => <String, dynamic>{
|
||||
'name': 'GPURasterizer::Draw', 'ph': 'E', 'ts': timeStamp
|
||||
'name': 'GPURasterizer::Draw', 'ph': 'E', 'ts': timeStamp,
|
||||
};
|
||||
|
||||
List<Map<String, dynamic>> rasterizeTimeSequenceInMillis(List<int> sequence) {
|
||||
@@ -50,7 +50,7 @@ void main() {
|
||||
build(1000, 1000),
|
||||
build(3000, 2000),
|
||||
]).countFrames(),
|
||||
2
|
||||
2,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -59,7 +59,7 @@ void main() {
|
||||
test('throws when there is no data', () {
|
||||
expect(
|
||||
() => summarize(<Map<String, dynamic>>[]).computeAverageFrameBuildTimeMillis(),
|
||||
throwsA(predicate<ArgumentError>((ArgumentError e) => e.message == 'durations is empty!'))
|
||||
throwsA(predicate<ArgumentError>((ArgumentError e) => e.message == 'durations is empty!')),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -69,7 +69,7 @@ void main() {
|
||||
build(1000, 1000),
|
||||
build(3000, 2000),
|
||||
]).computeAverageFrameBuildTimeMillis(),
|
||||
1.5
|
||||
1.5,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -78,7 +78,7 @@ void main() {
|
||||
test('throws when there is no data', () {
|
||||
expect(
|
||||
() => summarize(<Map<String, dynamic>>[]).computeWorstFrameBuildTimeMillis(),
|
||||
throwsA(predicate<ArgumentError>((ArgumentError e) => e.message == 'durations is empty!'))
|
||||
throwsA(predicate<ArgumentError>((ArgumentError e) => e.message == 'durations is empty!')),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -88,14 +88,14 @@ void main() {
|
||||
build(1000, 1000),
|
||||
build(3000, 2000),
|
||||
]).computeWorstFrameBuildTimeMillis(),
|
||||
2.0
|
||||
2.0,
|
||||
);
|
||||
expect(
|
||||
summarize(<Map<String, dynamic>>[
|
||||
build(3000, 2000),
|
||||
build(1000, 1000),
|
||||
]).computeWorstFrameBuildTimeMillis(),
|
||||
2.0
|
||||
2.0,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -117,7 +117,7 @@ void main() {
|
||||
test('throws when there is no data', () {
|
||||
expect(
|
||||
() => summarize(<Map<String, dynamic>>[]).computeAverageFrameRasterizerTimeMillis(),
|
||||
throwsA(predicate<ArgumentError>((ArgumentError e) => e.message == 'durations is empty!'))
|
||||
throwsA(predicate<ArgumentError>((ArgumentError e) => e.message == 'durations is empty!')),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -127,7 +127,7 @@ void main() {
|
||||
begin(1000), end(2000),
|
||||
begin(3000), end(5000),
|
||||
]).computeAverageFrameRasterizerTimeMillis(),
|
||||
1.5
|
||||
1.5,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -137,7 +137,7 @@ void main() {
|
||||
end(1000),
|
||||
begin(2000), end(4000),
|
||||
]).computeAverageFrameRasterizerTimeMillis(),
|
||||
2.0
|
||||
2.0,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -147,7 +147,7 @@ void main() {
|
||||
begin(2000), end(4000),
|
||||
begin(5000),
|
||||
]).computeAverageFrameRasterizerTimeMillis(),
|
||||
2.0
|
||||
2.0,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -156,7 +156,7 @@ void main() {
|
||||
test('throws when there is no data', () {
|
||||
expect(
|
||||
() => summarize(<Map<String, dynamic>>[]).computeWorstFrameRasterizerTimeMillis(),
|
||||
throwsA(predicate<ArgumentError>((ArgumentError e) => e.message == 'durations is empty!'))
|
||||
throwsA(predicate<ArgumentError>((ArgumentError e) => e.message == 'durations is empty!')),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -167,14 +167,14 @@ void main() {
|
||||
begin(1000), end(2000),
|
||||
begin(3000), end(5000),
|
||||
]).computeWorstFrameRasterizerTimeMillis(),
|
||||
2.0
|
||||
2.0,
|
||||
);
|
||||
expect(
|
||||
summarize(<Map<String, dynamic>>[
|
||||
begin(3000), end(5000),
|
||||
begin(1000), end(2000),
|
||||
]).computeWorstFrameRasterizerTimeMillis(),
|
||||
2.0
|
||||
2.0,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -184,7 +184,7 @@ void main() {
|
||||
end(1000),
|
||||
begin(2000), end(4000),
|
||||
]).computeWorstFrameRasterizerTimeMillis(),
|
||||
2.0
|
||||
2.0,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -194,7 +194,7 @@ void main() {
|
||||
begin(2000), end(4000),
|
||||
begin(5000),
|
||||
]).computeWorstFrameRasterizerTimeMillis(),
|
||||
2.0
|
||||
2.0,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -203,7 +203,7 @@ void main() {
|
||||
test('throws when there is no data', () {
|
||||
expect(
|
||||
() => summarize(<Map<String, dynamic>>[]).computePercentileFrameRasterizerTimeMillis(90.0),
|
||||
throwsA(predicate<ArgumentError>((ArgumentError e) => e.message == 'durations is empty!'))
|
||||
throwsA(predicate<ArgumentError>((ArgumentError e) => e.message == 'durations is empty!')),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -211,20 +211,20 @@ void main() {
|
||||
const List<List<int>> sequences = <List<int>>[
|
||||
<int>[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||
<int>[1, 2, 3, 4, 5],
|
||||
<int>[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
|
||||
<int>[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
|
||||
];
|
||||
|
||||
const List<int> p90s = <int>[
|
||||
9,
|
||||
5,
|
||||
18
|
||||
18,
|
||||
];
|
||||
|
||||
test('computes 90th frame rasterizer time in milliseconds', () {
|
||||
for(int i = 0; i < sequences.length; ++i) {
|
||||
expect(
|
||||
summarize(rasterizeTimeSequenceInMillis(sequences[i])).computePercentileFrameRasterizerTimeMillis(90.0),
|
||||
p90s[i]
|
||||
p90s[i],
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -236,7 +236,7 @@ void main() {
|
||||
}
|
||||
expect(
|
||||
summarize(rasterizeTimeSequenceInMillis(sequence)).computePercentileFrameRasterizerTimeMillis(99.0),
|
||||
99
|
||||
99,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -278,7 +278,7 @@ void main() {
|
||||
'frame_count': 3,
|
||||
'frame_build_times': <int>[17000, 9000, 19000],
|
||||
'frame_rasterizer_times': <int>[18000, 10000, 20000],
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -23,11 +23,11 @@ void main() {
|
||||
'tts': 567,
|
||||
'args': <String, dynamic>{
|
||||
'arg1': true,
|
||||
}
|
||||
},
|
||||
},
|
||||
// Tests that we don't choke on missing data
|
||||
<String, dynamic>{}
|
||||
]
|
||||
<String, dynamic>{},
|
||||
],
|
||||
});
|
||||
|
||||
expect(timeline.events, hasLength(2));
|
||||
|
||||
Reference in New Issue
Block a user