Skip to content

Commit fbf331e

Browse files
srawlinsCommit Queue
authored andcommitted
DAS: reformat source code with tall-style
Change-Id: I42b4a44fd6a2197e499e8623274b3cd1a4b5556f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394003 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Bob Nystrom <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent b082a8e commit fbf331e

File tree

1,092 files changed

+40740
-29321
lines changed

Some content is hidden

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

1,092 files changed

+40740
-29321
lines changed

pkg/analysis_server/benchmark/benchmarks.dart

Lines changed: 57 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,12 @@ abstract class Benchmark {
7070
/// One of 'memory', 'cpu', or 'group'.
7171
final String kind;
7272

73-
Benchmark(this.id, this.description,
74-
{this.enabled = true, required this.kind});
73+
Benchmark(
74+
this.id,
75+
this.description, {
76+
this.enabled = true,
77+
required this.kind,
78+
});
7579

7680
int get maxIterations => 0;
7781

@@ -87,8 +91,12 @@ abstract class Benchmark {
8791
bool verbose = false,
8892
});
8993

90-
Map<String, Object?> toJson() =>
91-
{'id': id, 'description': description, 'enabled': enabled, 'kind': kind};
94+
Map<String, Object?> toJson() => {
95+
'id': id,
96+
'description': description,
97+
'enabled': enabled,
98+
'kind': kind,
99+
};
92100

93101
@override
94102
String toString() => '$id: $description';
@@ -132,10 +140,7 @@ class CompoundBenchMarkResult extends BenchMarkResult {
132140
}
133141

134142
var combined = CompoundBenchMarkResult(name);
135-
var keys = {
136-
...results.keys,
137-
...other.results.keys,
138-
}.toList();
143+
var keys = {...results.keys, ...other.results.keys}.toList();
139144

140145
for (var key in keys) {
141146
combined.add(key, combine(results[key], other.results[key]));
@@ -167,8 +172,11 @@ class ListCommand extends Command<void> {
167172
final List<Benchmark> benchmarks;
168173

169174
ListCommand(this.benchmarks) {
170-
argParser.addFlag('machine',
171-
negatable: false, help: 'Emit the list of benchmarks as json.');
175+
argParser.addFlag(
176+
'machine',
177+
negatable: false,
178+
help: 'Emit the list of benchmarks as json.',
179+
);
172180
}
173181

174182
@override
@@ -184,7 +192,7 @@ class ListCommand extends Command<void> {
184192
void run() {
185193
if (argResults!['machine'] as bool) {
186194
var map = <String, Object?>{
187-
'benchmarks': benchmarks.map((b) => b.toJson()).toList()
195+
'benchmarks': benchmarks.map((b) => b.toJson()).toList(),
188196
};
189197
print(JsonEncoder.withIndent(' ').convert(map));
190198
} else {
@@ -199,20 +207,32 @@ class RunCommand extends Command<void> {
199207
final List<Benchmark> benchmarks;
200208

201209
RunCommand(this.benchmarks) {
202-
argParser.addOption('dart-sdk',
203-
help: 'The absolute normalized path of the Dart SDK.');
204-
argParser.addOption('flutter-repository',
205-
help: 'The absolute normalized path of the Flutter repository.');
206-
argParser.addFlag('quick',
207-
negatable: false,
208-
help: 'Run a quick version of the benchmark. This is not useful for '
209-
'gathering accurate times,\nbut can be used to validate that the '
210-
'benchmark works.');
211-
argParser.addOption('repeat',
212-
defaultsTo: '4', help: 'The number of times to repeat the benchmark.');
213-
argParser.addFlag('verbose',
214-
negatable: false,
215-
help: 'Print all communication to and from the analysis server.');
210+
argParser.addOption(
211+
'dart-sdk',
212+
help: 'The absolute normalized path of the Dart SDK.',
213+
);
214+
argParser.addOption(
215+
'flutter-repository',
216+
help: 'The absolute normalized path of the Flutter repository.',
217+
);
218+
argParser.addFlag(
219+
'quick',
220+
negatable: false,
221+
help:
222+
'Run a quick version of the benchmark. This is not useful for '
223+
'gathering accurate times,\nbut can be used to validate that the '
224+
'benchmark works.',
225+
);
226+
argParser.addOption(
227+
'repeat',
228+
defaultsTo: '4',
229+
help: 'The number of times to repeat the benchmark.',
230+
);
231+
argParser.addFlag(
232+
'verbose',
233+
negatable: false,
234+
help: 'Print all communication to and from the analysis server.',
235+
);
216236
}
217237

218238
@override
@@ -242,11 +262,13 @@ class RunCommand extends Command<void> {
242262
var quick = args['quick'] as bool;
243263
var verbose = args['verbose'] as bool;
244264

245-
var benchmark =
246-
benchmarks.firstWhere((b) => b.id == benchmarkId, orElse: () {
247-
print("Benchmark '$benchmarkId' not found.");
248-
exit(1);
249-
});
265+
var benchmark = benchmarks.firstWhere(
266+
(b) => b.id == benchmarkId,
267+
orElse: () {
268+
print("Benchmark '$benchmarkId' not found.");
269+
exit(1);
270+
},
271+
);
250272

251273
dartSdkPath ??= path.dirname(path.dirname(Platform.resolvedExecutable));
252274

@@ -261,8 +283,10 @@ class RunCommand extends Command<void> {
261283
exit(1);
262284
}
263285
} else {
264-
print('The option --flutter-repository is required to '
265-
"run '$benchmarkId'.");
286+
print(
287+
'The option --flutter-repository is required to '
288+
"run '$benchmarkId'.",
289+
);
266290
exit(1);
267291
}
268292
}
@@ -296,7 +320,7 @@ class RunCommand extends Command<void> {
296320
print('Finished in ${time.elapsed.inSeconds} seconds.\n');
297321
var m = <String, dynamic>{
298322
'benchmark': benchmarkId,
299-
'result': result!.toJson()
323+
'result': result!.toJson(),
300324
};
301325
print(json.encode(m));
302326

pkg/analysis_server/benchmark/integration/driver.dart

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ class Driver extends IntegrationTest {
6161
/// If the server acknowledges the command with an error response, the future
6262
/// will be completed with an error.
6363
Future<Map<String, Object?>?> send(
64-
String method, Map<String, dynamic> params) {
64+
String method,
65+
Map<String, dynamic> params,
66+
) {
6567
return server.send(method, params);
6668
}
6769

@@ -81,14 +83,14 @@ class Driver extends IntegrationTest {
8183
return server
8284
.start(dartSdkPath: dartSdkPath, diagnosticPort: diagnosticPort)
8385
.then((params) {
84-
server.listenToOutput(dispatchNotification);
85-
server.exitCode.then((_) {
86-
logger.log(Level.FINE, 'server stopped');
87-
running = false;
88-
_resultsReady();
89-
});
90-
return serverConnected.future;
91-
});
86+
server.listenToOutput(dispatchNotification);
87+
server.exitCode.then((_) {
88+
logger.log(Level.FINE, 'server stopped');
89+
running = false;
90+
_resultsReady();
91+
});
92+
return serverConnected.future;
93+
});
9294
}
9395

9496
/// Shutdown the analysis server if it is running.
@@ -98,9 +100,12 @@ class Driver extends IntegrationTest {
98100
// Give the server a short time to comply with the shutdown request; if it
99101
// doesn't exit, then forcibly terminate it.
100102
unawaited(sendServerShutdown());
101-
await server.exitCode.timeout(timeout, onTimeout: () {
102-
return server.kill('server failed to exit');
103-
});
103+
await server.exitCode.timeout(
104+
timeout,
105+
onTimeout: () {
106+
return server.kill('server failed to exit');
107+
},
108+
);
104109
}
105110
_resultsReady();
106111
}
@@ -206,7 +211,11 @@ class Results {
206211
}
207212
}
208213
_printTotals(
209-
keyLen, totalCount, totalErrorCount, totalUnexpectedResultCount);
214+
keyLen,
215+
totalCount,
216+
totalErrorCount,
217+
totalUnexpectedResultCount,
218+
);
210219
print('');
211220
_printGroupHeader('Notifications', keyLen);
212221
for (var entry in sortedEntries) {
@@ -225,8 +234,12 @@ class Results {
225234
}
226235

227236
/// Record the elapsed time for the given operation.
228-
void record(String tag, Duration elapsed,
229-
{bool notification = false, bool success = true}) {
237+
void record(
238+
String tag,
239+
Duration elapsed, {
240+
bool notification = false,
241+
bool success = true,
242+
}) {
230243
var measurement = measurements[tag];
231244
if (measurement == null) {
232245
measurement = Measurement(tag, notification);
@@ -256,8 +269,12 @@ class Results {
256269
print(buffer.toString());
257270
}
258271

259-
static void _printTotals(int keyLength, int totalCount, int totalErrorCount,
260-
int totalUnexpectedResultCount) {
272+
static void _printTotals(
273+
int keyLength,
274+
int totalCount,
275+
int totalErrorCount,
276+
int totalUnexpectedResultCount,
277+
) {
261278
var buffer = StringBuffer();
262279
buffer.writePadRight('Totals', keyLength);
263280
buffer.writePadLeft(totalCount.toString(), 6);

pkg/analysis_server/benchmark/integration/input_converter.dart

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ abstract class CommonInputConverter extends Converter<String, Operation?> {
9494
// Track overlays in parallel with the analysis server
9595
// so that when an overlay is removed, the file can be updated on disk
9696
var request = Request.fromJson(json)!;
97-
var params = AnalysisUpdateContentParams.fromRequest(request,
98-
clientUriConverter: null);
97+
var params = AnalysisUpdateContentParams.fromRequest(
98+
request,
99+
clientUriConverter: null,
100+
);
99101
params.files.forEach((String filePath, change) {
100102
if (change is AddContentOverlay) {
101103
var content = change.content;
@@ -148,8 +150,11 @@ abstract class CommonInputConverter extends Converter<String, Operation?> {
148150

149151
/// Return an operation for the recorded/expected response.
150152
Operation convertResponse(Map<String, dynamic> json) {
151-
return ResponseOperation(this, asMap(requestMap.remove(json['id'])),
152-
asMap(translateSrcPaths(json)));
153+
return ResponseOperation(
154+
this,
155+
asMap(requestMap.remove(json['id'])),
156+
asMap(translateSrcPaths(json)),
157+
);
153158
}
154159

155160
void logOverlayContent() {
@@ -182,7 +187,9 @@ abstract class CommonInputConverter extends Converter<String, Operation?> {
182187
/// or `null` if the response has already been received
183188
/// and the completer completed.
184189
Future<void>? processExpectedResponse(
185-
String id, Completer<Object?> completer) {
190+
String id,
191+
Completer<Object?> completer,
192+
) {
186193
if (responseMap.containsKey(id)) {
187194
logger.log(Level.INFO, 'processing cached response $id');
188195
completer.complete(responseMap.remove(id));

pkg/analysis_server/benchmark/integration/instrumentation_input_converter.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ class InstrumentationInputConverter extends CommonInputConverter {
4343
}
4444
} catch (e, s) {
4545
throw AnalysisException(
46-
'Failed to parse line\n$line', CaughtException(e, s));
46+
'Failed to parse line\n$line',
47+
CaughtException(e, s),
48+
);
4749
}
4850
// int timeStamp = int.parse(fields[0], onError: (_) => -1);
4951
var opCode = fields[1];
@@ -71,7 +73,9 @@ class InstrumentationInputConverter extends CommonInputConverter {
7173
}
7274
if (codesSeen.add(opCode)) {
7375
logger.log(
74-
Level.WARNING, 'Ignored instrumentation op code: $opCode\n $line');
76+
Level.WARNING,
77+
'Ignored instrumentation op code: $opCode\n $line',
78+
);
7579
}
7680
return null;
7781
}
@@ -81,7 +85,9 @@ class InstrumentationInputConverter extends CommonInputConverter {
8185
return asMap(json.decode(text));
8286
} catch (e, s) {
8387
throw AnalysisException(
84-
'Failed to decode JSON: $text\n$line', CaughtException(e, s));
88+
'Failed to decode JSON: $text\n$line',
89+
CaughtException(e, s),
90+
);
8591
}
8692
}
8793

pkg/analysis_server/benchmark/integration/local_runner.dart

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ void main(List<String> args) {
2626
/*
2727
* Create a new temp directory
2828
*/
29-
var tmpDir =
30-
Directory(join(Directory.systemTemp.path, 'analysis_server_perf_target'));
29+
var tmpDir = Directory(
30+
join(Directory.systemTemp.path, 'analysis_server_perf_target'),
31+
);
3132
if (!tmpDir.path.contains('tmp')) throw 'invalid tmp directory\n $tmpDir';
3233
print('Extracting target analysis environment into\n ${tmpDir.path}');
3334
if (tmpDir.existsSync()) tmpDir.deleteSync(recursive: true);
@@ -36,13 +37,19 @@ void main(List<String> args) {
3637
* Setup the initial target source in the temp directory
3738
*/
3839
var tarFilePath = join(tmpDir.path, 'targetSrc.tar');
39-
var result = Process.runSync('git', ['archive', branch, '-o', tarFilePath],
40-
workingDirectory: gitDir.path);
40+
var result = Process.runSync('git', [
41+
'archive',
42+
branch,
43+
'-o',
44+
tarFilePath,
45+
], workingDirectory: gitDir.path);
4146
if (result.exitCode != 0) throw 'failed to obtain target source: $result';
4247
var tmpSrcDirPath = join(tmpDir.path, 'targetSrc');
4348
Directory(tmpSrcDirPath).createSync();
44-
result = Process.runSync('tar', ['-xf', tarFilePath],
45-
workingDirectory: tmpSrcDirPath);
49+
result = Process.runSync('tar', [
50+
'-xf',
51+
tarFilePath,
52+
], workingDirectory: tmpSrcDirPath);
4653
if (result.exitCode != 0) throw 'failed to extract target source: $result';
4754
/*
4855
* Symlink the out or xcodebuild directory
@@ -54,16 +61,16 @@ void main(List<String> args) {
5461
if (!Directory(join(gitDir.path, outDirName)).existsSync()) {
5562
throw 'failed to find out or xcodebuild directory';
5663
}
57-
result = Process.runSync('ln',
58-
['-s', join(gitDir.path, outDirName), join(tmpSrcDirPath, outDirName)]);
64+
result = Process.runSync('ln', [
65+
'-s',
66+
join(gitDir.path, outDirName),
67+
join(tmpSrcDirPath, outDirName),
68+
]);
5969
if (result.exitCode != 0) throw 'failed to link out or xcodebuild: $result';
6070
/*
6171
* Collect arguments
6272
*/
63-
var perfArgs = [
64-
'-i${inputFile.path}',
65-
'-t$tmpSrcDirPath',
66-
];
73+
var perfArgs = ['-i${inputFile.path}', '-t$tmpSrcDirPath'];
6774
for (var index = 3; index < args.length; ++index) {
6875
perfArgs.add(args[index].replaceAll('@tmpSrcDir@', tmpSrcDirPath));
6976
}

pkg/analysis_server/benchmark/integration/log_file_input_converter.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ class LogFileInputConverter extends CommonInputConverter {
4444
return null;
4545
} catch (e, s) {
4646
throw AnalysisException(
47-
'Failed to parse line\n $line', CaughtException(e, s));
47+
'Failed to parse line\n $line',
48+
CaughtException(e, s),
49+
);
4850
}
4951
}
5052

0 commit comments

Comments
 (0)