Skip to content

Commit

Permalink
Update to latest lints and Dart SDK (#828)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo committed May 31, 2023
1 parent 346a72d commit da6953c
Show file tree
Hide file tree
Showing 88 changed files with 563 additions and 577 deletions.
54 changes: 27 additions & 27 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ jobs:
- name: mono_repo self validate
run: dart pub global run mono_repo generate --validate
job_002:
name: "format_analyze; linux; Dart 2.12.0; PKG: protobuf; `dart analyze lib`, `dart analyze test`"
name: "format_analyze; linux; Dart 2.19.0; PKG: protobuf; `dart analyze lib`, `dart analyze test`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0;packages:protobuf;commands:analyze_1-analyze_2"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf;commands:analyze_1-analyze_2"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0;packages:protobuf
os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0
os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf
os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
with:
sdk: "2.12.0"
sdk: "2.19.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
Expand Down Expand Up @@ -233,23 +233,23 @@ jobs:
if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'"
working-directory: protoc_plugin
job_007:
name: "run_tests; linux; Dart 2.12.0; PKG: protobuf; `dart test`"
name: "run_tests; linux; Dart 2.19.0; PKG: protobuf; `dart test`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0;packages:protobuf;commands:test_0"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf;commands:test_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0;packages:protobuf
os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0
os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf
os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
with:
sdk: "2.12.0"
sdk: "2.19.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
Expand All @@ -270,23 +270,23 @@ jobs:
- job_005
- job_006
job_008:
name: "run_tests; linux; Dart 2.17.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test`"
name: "run_tests; linux; Dart 2.19.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:protoc_plugin;commands:command_0-command_3-test_0"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin;commands:command_0-command_3-test_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:protoc_plugin
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0
os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin
os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
with:
sdk: "2.17.0"
sdk: "2.19.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
Expand Down Expand Up @@ -397,23 +397,23 @@ jobs:
- job_005
- job_006
job_011:
name: "run_tests; osx; Dart 2.12.0; PKG: protobuf; `dart test`"
name: "run_tests; osx; Dart 2.19.0; PKG: protobuf; `dart test`"
runs-on: macos-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
with:
path: "~/.pub-cache/hosted"
key: "os:macos-latest;pub-cache-hosted;sdk:2.12.0;packages:protobuf;commands:test_0"
key: "os:macos-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf;commands:test_0"
restore-keys: |
os:macos-latest;pub-cache-hosted;sdk:2.12.0;packages:protobuf
os:macos-latest;pub-cache-hosted;sdk:2.12.0
os:macos-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf
os:macos-latest;pub-cache-hosted;sdk:2.19.0
os:macos-latest;pub-cache-hosted
os:macos-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
with:
sdk: "2.12.0"
sdk: "2.19.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
Expand Down Expand Up @@ -471,13 +471,13 @@ jobs:
- job_005
- job_006
job_013:
name: "run_tests; windows; Dart 2.12.0; PKG: protobuf; `dart test`"
name: "run_tests; windows; Dart 2.19.0; PKG: protobuf; `dart test`"
runs-on: windows-latest
steps:
- name: Setup Dart SDK
uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
with:
sdk: "2.12.0"
sdk: "2.19.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
Expand Down Expand Up @@ -525,23 +525,23 @@ jobs:
- job_005
- job_006
job_015:
name: "run_legacy_tests; linux; Dart 2.17.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test legacy_tests/generated_message_test.dart`"
name: "run_legacy_tests; linux; Dart 2.19.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test legacy_tests/generated_message_test.dart`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:protoc_plugin;commands:command_0-command_3-test_1"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin;commands:command_0-command_3-test_1"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:protoc_plugin
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0
os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin
os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
with:
sdk: "2.17.0"
sdk: "2.19.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
Expand Down
16 changes: 4 additions & 12 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
include: package:lints/recommended.yaml
include: package:dart_flutter_team_lints/analysis_options.yaml

analyzer:
language:
strict-casts: true
errors:
lines_longer_than_80_chars: ignore

linter:
rules:
- always_declare_return_types
- avoid_bool_literals_in_conditional_expressions
- camel_case_types
- comment_references
- directives_ordering
- no_leading_underscores_for_local_identifiers
- omit_local_variable_types
- prefer_final_in_for_each
- prefer_final_locals
- prefer_relative_imports
- prefer_single_quotes
- prefer_spread_collections
- sort_pub_dependencies
- throw_in_finally
- type_annotate_public_apis
- unawaited_futures
- use_super_parameters
2 changes: 2 additions & 0 deletions api_benchmark/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ include: ../analysis_options.yaml
analyzer:
language:
strict-casts: false
errors:
only_throw_errors: ignore
2 changes: 1 addition & 1 deletion api_benchmark/lib/benchmarks/get_strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import '../benchmark.dart';
import '../generated/benchmark.pb.dart'
show BenchmarkID, Request, Params, Sample;
show BenchmarkID, Params, Request, Sample;
import '../generated/string_grid.pb.dart' as pb;

/// A benchmark that accesses each value in a grid of string fields.
Expand Down
2 changes: 1 addition & 1 deletion api_benchmark/lib/benchmarks/has_strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import '../benchmark.dart';
import '../generated/benchmark.pb.dart'
show BenchmarkID, Request, Params, Sample;
show BenchmarkID, Params, Request, Sample;
import '../generated/string_grid.pb.dart' as pb;

/// A benchmark that checks the existence of each item in a grid of strings.
Expand Down
2 changes: 1 addition & 1 deletion api_benchmark/lib/benchmarks/int32_json.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import '../benchmark.dart';
import '../generated/benchmark.pb.dart'
show BenchmarkID, Request, Params, Sample;
show BenchmarkID, Params, Request, Sample;
import '../generated/int32grid.pb.dart' as pb;

/// A benchmark that deserializes a grid of int fields.
Expand Down
2 changes: 1 addition & 1 deletion api_benchmark/lib/benchmarks/int64_json.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:fixnum/fixnum.dart' show Int64;

import '../benchmark.dart';
import '../generated/benchmark.pb.dart'
show BenchmarkID, Request, Params, Sample;
show BenchmarkID, Params, Request, Sample;
import '../generated/int64grid.pb.dart' as pb;

/// A benchmark that deserializes a grid of int fields.
Expand Down
2 changes: 1 addition & 1 deletion api_benchmark/lib/benchmarks/repeated_int32_json.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import '../benchmark.dart';
import '../generated/benchmark.pb.dart'
show BenchmarkID, Request, Params, Sample;
show BenchmarkID, Params, Request, Sample;
import '../generated/int32grid.pb.dart' as pb;

/// A benchmark that deserializes a grid of repeated ints.
Expand Down
2 changes: 1 addition & 1 deletion api_benchmark/lib/benchmarks/repeated_int64_json.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:fixnum/fixnum.dart';

import '../benchmark.dart';
import '../generated/benchmark.pb.dart'
show BenchmarkID, Request, Params, Sample;
show BenchmarkID, Params, Request, Sample;
import '../generated/int64grid.pb.dart' as pb;

/// A benchmark that deserializes a grid of repeated ints.
Expand Down
2 changes: 1 addition & 1 deletion api_benchmark/lib/benchmarks/repeated_string_json.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import '../benchmark.dart';
import '../generated/benchmark.pb.dart'
show BenchmarkID, Request, Params, Sample;
show BenchmarkID, Params, Request, Sample;
import '../generated/string_grid.pb.dart' as pb;

/// A benchmark that deserializes a grid of string fields.
Expand Down
2 changes: 1 addition & 1 deletion api_benchmark/lib/benchmarks/set_strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import '../benchmark.dart';
import '../generated/benchmark.pb.dart'
show BenchmarkID, Request, Params, Sample;
show BenchmarkID, Params, Request, Sample;
import '../generated/string_grid.pb.dart' as pb;

/// A benchmark that sets each value in a grid of string fields.
Expand Down
4 changes: 2 additions & 2 deletions api_benchmark/lib/benchmarks/string_json.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import '../benchmark.dart';
import '../generated/benchmark.pb.dart'
show BenchmarkID, Request, Params, Sample;
show BenchmarkID, Params, Request, Sample;
import '../generated/string_grid.pb.dart' as pb;

/// A benchmark that deserializes a grid of string fields.
Expand Down Expand Up @@ -66,7 +66,7 @@ class StringBenchmark extends Benchmark {
@override
void run() {
final grid = pb.Grid10.fromJson(json);
final actual = grid.lines[height - 1].getField(lastFieldTag!);
final actual = grid.lines[height - 1].getField(lastFieldTag!) as String;
if (actual.length != stringSize) throw 'failed; got $actual';
}

Expand Down
6 changes: 3 additions & 3 deletions api_benchmark/lib/dashboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import 'dart:async' show Future;
import 'dart:convert';
import 'dart:html';
import 'dart:js' show context, JsObject;
import 'dart:js' show JsObject, context;

import 'benchmark.dart' show Profiler;
import 'dashboard_model.dart' show DashboardModel, Table, SelectEvent;
import 'dashboard_model.dart' show DashboardModel, SelectEvent, Table;
import 'dashboard_view.dart' show DashboardView;
import 'data_index.dart' as data;
import 'generated/benchmark.pb.dart' as pb;
import 'report.dart' show createPlatform, createPackages;
import 'report.dart' show createPackages, createPlatform;
import 'suite.dart' show runSuite;

/// Displays a dashboard that can be used to run benchmarks.
Expand Down
3 changes: 2 additions & 1 deletion api_benchmark/lib/dashboard_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class Table {
Table._raw(suite, null, null, Set<pb.Request>.from(suite.requests));

Table._raw(this.suite, this.baseline, this.report, this.selections) {
final it = report == null ? [].iterator : report!.responses.iterator;
final it =
report == null ? <pb.Response>[].iterator : report!.responses.iterator;
for (final r in suite.requests) {
final b = createBenchmark(r);
pb.Sample? baseline;
Expand Down
2 changes: 1 addition & 1 deletion api_benchmark/lib/dashboard_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async' show Stream, StreamController, EventSink;
import 'dart:async' show EventSink, Stream, StreamController;
import 'dart:html';

import 'dashboard_model.dart';
Expand Down
4 changes: 2 additions & 2 deletions api_benchmark/lib/report.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ String encodeReport(pb.Report report) {
}

String _stringifyMap(StringBuffer out, Map json, String indent) {
final childIndent = indent + ' ';
final childIndent = '$indent ';
out.writeln('{');
var first = true;
for (final key in json.keys) {
Expand All @@ -124,7 +124,7 @@ String _stringifyMap(StringBuffer out, Map json, String indent) {
}

void _stringifyList(StringBuffer out, List json, String indent) {
final childIndent = indent + ' ';
final childIndent = '$indent ';
out.write('[\n');
var first = true;
for (final item in json) {
Expand Down
10 changes: 5 additions & 5 deletions api_benchmark/lib/vm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
// BSD-style license that can be found in the LICENSE file.

import 'dart:async' show Future;
import 'dart:io' show File, Directory, Link, Platform, stdout;
import 'dart:io' show Directory, File, Link, Platform, stdout;

import 'benchmarks/index.dart' show createBenchmark;
import 'data_index.dart'
show latestVMReportName, pubspecYamlName, pubspecLockName, hostfileName;
show hostfileName, latestVMReportName, pubspecLockName, pubspecYamlName;
import 'generated/benchmark.pb.dart' as pb;
import 'report.dart'
show createPlatform, createPackages, encodeReport, findUpdatedResponse;
show createPackages, createPlatform, encodeReport, findUpdatedResponse;
import 'suite.dart' show runSuite;

/// Runs a benchmark suite.
Expand Down Expand Up @@ -68,8 +68,8 @@ Future<pb.Env> _loadEnv() async {
..osType = _osType
..dartVersion = Platform.version;

final pubspec = await (File(pubspecYaml.path).readAsString());
final lock = await (File(pubspecLock.path).readAsString());
final pubspec = await File(pubspecYaml.path).readAsString();
final lock = await File(pubspecLock.path).readAsString();

return pb.Env()
..script = _script
Expand Down
9 changes: 5 additions & 4 deletions api_benchmark/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,21 @@ description: Benchmarking a number of different api calls.
publish_to: none

environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=2.19.0 <3.0.0'

dependencies:
fixnum: any
protobuf: any
yaml: ^3.0.0

dev_dependencies:
build: ^2.0.0
build_runner: ^2.0.6
build_web_compilers: ^3.0.0
build_web_compilers: ^4.0.0
dart_flutter_team_lints: ^1.0.0
glob: ^2.0.0
lints: ^1.0.0
protoc_plugin:
path: "../protoc_plugin"
yaml: ^3.0.0

dependency_overrides:
protobuf:
Expand Down
Loading

0 comments on commit da6953c

Please sign in to comment.