Skip to content

Commit 3a501da

Browse files
parloughathomas
authored andcommitted
[current_results] Update dependencies and lints
- Update dependencies - Adds dependencies used but missing from pubspec - Switch to package:lints and make fixes Change-Id: I6ccbf0bc57b6def2bb49760ecabedb1d51d217d6 Reviewed-on: https://dart-review.googlesource.com/c/dart_ci/+/351820 Reviewed-by: Alexander Thomas <[email protected]> Reviewed-by: William Hesse <[email protected]> Auto-Submit: Parker Lougheed <[email protected]>
1 parent e810462 commit 3a501da

File tree

8 files changed

+93
-90
lines changed

8 files changed

+93
-90
lines changed
Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1 @@
1-
# Defines a default set of lint rules enforced for
2-
# projects at Google. For details and rationale,
3-
# see https://github.com/dart-lang/pedantic#enabled-lints.
4-
include: package:pedantic/analysis_options.yaml
5-
6-
# For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
7-
# Uncomment to specify additional rules.
8-
# linter:
9-
# rules:
10-
# - camel_case_types
11-
12-
analyzer:
13-
# exclude:
14-
# - path/to/excluded/files/**
1+
include: package:lints/recommended.yaml

current_results/bin/client.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void main(List<String> args) async {
2222
await runner.run(args);
2323
}
2424

25-
abstract class gRpcCommand extends Command {
25+
abstract class GrpcCommand extends Command<void> {
2626
Future<void> runWithClient(QueryClient client);
2727
@override
2828
Future<void> run() async {
@@ -41,7 +41,7 @@ abstract class gRpcCommand extends Command {
4141
}
4242
}
4343

44-
class QueryCommand extends gRpcCommand {
44+
class QueryCommand extends GrpcCommand {
4545
QueryCommand() {
4646
argParser.addOption('filter',
4747
abbr: 'f',
@@ -72,7 +72,7 @@ class QueryCommand extends gRpcCommand {
7272
}
7373
}
7474

75-
class ListTestsCommand extends gRpcCommand {
75+
class ListTestsCommand extends GrpcCommand {
7676
ListTestsCommand() {
7777
argParser.addOption('prefix',
7878
defaultsTo: '', help: 'test name prefix to fetch test names for');
@@ -96,7 +96,7 @@ class ListTestsCommand extends gRpcCommand {
9696
}
9797
}
9898

99-
class FetchCommand extends gRpcCommand {
99+
class FetchCommand extends GrpcCommand {
100100
@override
101101
String get name => 'fetch';
102102
@override

current_results/bin/server.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ Future<void> startServer(int port, ResultsBucket bucket) async {
2828
final notifications = BucketNotifications();
2929
await notifications.initialize();
3030
final current = await loadData(bucket);
31-
final grpcServer = Server([QueryService(current, notifications, bucket)]);
31+
final grpcServer = Server.create(
32+
services: [QueryService(current, notifications, bucket)],
33+
);
3234
await grpcServer.serve(port: port);
3335
print('Grpc serving on port ${grpcServer.port}');
3436
}
@@ -48,6 +50,6 @@ Future<Slice> loadData(ResultsBucket bucket) async {
4850
} catch (e, stack) {
4951
print('Error loading configuration $configurationDirectory: $e\n$stack');
5052
}
51-
}).drain();
53+
}).drain<void>();
5254
return result;
5355
}

current_results/lib/src/api_impl.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,28 @@ class QueryService extends QueryServiceBase {
1818

1919
@override
2020
Future<GetResultsResponse> getResults(
21-
ServiceCall call, GetResultsRequest query) =>
22-
Future.value(current.results(query));
21+
ServiceCall call, GetResultsRequest request) =>
22+
Future.value(current.results(request));
2323

2424
@override
2525
Future<ListTestsResponse> listTests(
26-
ServiceCall call, ListTestsRequest query) =>
27-
Future.value(current.listTests(query));
26+
ServiceCall call, ListTestsRequest request) =>
27+
Future.value(current.listTests(request));
2828

2929
@override
3030
Future<ListTestsResponse> listTestPathCompletions(
31-
ServiceCall call, ListTestsRequest query) async {
31+
ServiceCall call, ListTestsRequest request) async {
3232
throw UnimplementedError();
3333
}
3434

3535
@override
3636
Future<ListConfigurationsResponse> listConfigurations(
37-
ServiceCall call, ListConfigurationsRequest query) async {
37+
ServiceCall call, ListConfigurationsRequest request) async {
3838
throw UnimplementedError;
3939
}
4040

4141
@override
42-
Future<FetchResponse> fetch(ServiceCall call, Empty _) async {
42+
Future<FetchResponse> fetch(ServiceCall call, Empty request) async {
4343
final response = FetchResponse();
4444
final messages = await notifications.getMessages();
4545
final latestObjectPattern = RegExp('^(configuration/main/[^/]+/)latest\$');

current_results/lib/src/slice.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ class Slice {
6767
int get size => _size;
6868

6969
void add(List<String> lines) {
70-
if (lines.isEmpty) return;
71-
var configuration;
70+
String? configuration;
7271
final results = <Result>[];
7372
for (final line in lines) {
7473
final result = Result.fromApi(api.Result()
@@ -85,6 +84,9 @@ class Slice {
8584
_experimentNames.addAll(result.experiments);
8685
results.add(result);
8786
}
87+
// If there were no results or they were all skips, don't continue.
88+
if (configuration == null) return;
89+
8890
final sorted = results.toList()..sort(compareNames);
8991
_size -= _stored[configuration]?.length ?? 0;
9092
_stored[configuration] = sorted;
@@ -242,7 +244,7 @@ class Slice {
242244
Set<String> experimentFilters, PageStart? pageStart,
243245
{required int needed}) {
244246
final prefixResult = Result.nameOnly(prefix);
245-
var startResult;
247+
final Result startResult;
246248
if (pageStart == null || pageStart.test.compareTo(prefixResult.name) <= 0) {
247249
startResult = prefixResult;
248250
} else if (pageStart.test.startsWith(prefixResult.name)) {

0 commit comments

Comments
 (0)