Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest lints #920

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 27 additions & 80 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Created with package:mono_repo v6.5.7
# Created with package:mono_repo v6.6.1
name: Dart CI
on:
push:
Expand Down Expand Up @@ -35,27 +35,27 @@ jobs:
name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: mono_repo self validate
run: dart pub global activate mono_repo 6.5.7
run: dart pub global activate mono_repo 6.6.1
- name: mono_repo self validate
run: dart pub global run mono_repo generate --validate
job_002:
name: "format_analyze; linux; Dart 2.19.0; PKG: protobuf; `dart analyze lib`, `dart analyze test`"
name: "format_analyze; linux; Dart 3.3.0; PKG: protobuf; `dart analyze lib`, `dart analyze test`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf;commands:analyze_1-analyze_2"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf;commands:analyze_1-analyze_2"
restore-keys: |
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;sdk:3.3.0;packages:protobuf
os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
with:
sdk: "2.19.0"
sdk: "3.3.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
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.19.0; PKG: protobuf; `dart test`"
name: "run_tests; linux; Dart 3.3.0; PKG: protobuf; `dart test`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf;commands:test_0"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf;commands:test"
restore-keys: |
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;sdk:3.3.0;packages:protobuf
os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
with:
sdk: "2.19.0"
sdk: "3.3.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
Expand All @@ -270,23 +270,23 @@ jobs:
- job_005
- job_006
job_008:
name: "run_tests; linux; Dart 2.19.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test`"
name: "run_tests; linux; Dart 3.3.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin;commands:command_0-command_3-test_0"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protoc_plugin;commands:command_0-command_3-test"
restore-keys: |
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;sdk:3.3.0;packages:protoc_plugin
os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
with:
sdk: "2.19.0"
sdk: "3.3.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
Expand Down Expand Up @@ -322,7 +322,7 @@ jobs:
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protobuf;commands:test_0"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protobuf;commands:test"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protobuf
os:ubuntu-latest;pub-cache-hosted;sdk:dev
Expand Down Expand Up @@ -359,7 +359,7 @@ jobs:
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin;commands:command_0-command_3-test_0"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin;commands:command_0-command_3-test"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin
os:ubuntu-latest;pub-cache-hosted;sdk:dev
Expand Down Expand Up @@ -397,23 +397,23 @@ jobs:
- job_005
- job_006
job_011:
name: "run_tests; osx; Dart 2.19.0; PKG: protobuf; `dart test`"
name: "run_tests; osx; Dart 3.3.0; PKG: protobuf; `dart test`"
runs-on: macos-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319
with:
path: "~/.pub-cache/hosted"
key: "os:macos-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf;commands:test_0"
key: "os:macos-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf;commands:test"
restore-keys: |
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;sdk:3.3.0;packages:protobuf
os:macos-latest;pub-cache-hosted;sdk:3.3.0
os:macos-latest;pub-cache-hosted
os:macos-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
with:
sdk: "2.19.0"
sdk: "3.3.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
Expand Down Expand Up @@ -441,7 +441,7 @@ jobs:
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319
with:
path: "~/.pub-cache/hosted"
key: "os:macos-latest;pub-cache-hosted;sdk:dev;packages:protobuf;commands:test_0"
key: "os:macos-latest;pub-cache-hosted;sdk:dev;packages:protobuf;commands:test"
restore-keys: |
os:macos-latest;pub-cache-hosted;sdk:dev;packages:protobuf
os:macos-latest;pub-cache-hosted;sdk:dev
Expand Down Expand Up @@ -471,13 +471,13 @@ jobs:
- job_005
- job_006
job_013:
name: "run_tests; windows; Dart 2.19.0; PKG: protobuf; `dart test`"
name: "run_tests; windows; Dart 3.3.0; PKG: protobuf; `dart test`"
runs-on: windows-latest
steps:
- name: Setup Dart SDK
uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
with:
sdk: "2.19.0"
sdk: "3.3.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
Expand Down Expand Up @@ -524,56 +524,3 @@ jobs:
- job_004
- job_005
- job_006
job_015:
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@ab5e6d0c87105b4c9c2047343972218f562e4319
with:
path: "~/.pub-cache/hosted"
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.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@fedb1266e91cf51be2fdb382869461a434b920a3
with:
sdk: "2.19.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- id: protoc_plugin_pub_upgrade
name: protoc_plugin; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: protoc_plugin
- name: protoc_plugin; ./../tool/setup.sh
run: ./../tool/setup.sh
if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'"
working-directory: protoc_plugin
- name: protoc_plugin; make protos
run: make protos
if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'"
working-directory: protoc_plugin
- name: protoc_plugin; dart test legacy_tests/generated_message_test.dart
run: dart test legacy_tests/generated_message_test.dart
if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'"
working-directory: protoc_plugin
needs:
- job_001
- job_002
- job_003
- job_004
- job_005
- job_006
- job_007
- job_008
- job_009
- job_010
- job_011
- job_012
- job_013
- job_014
6 changes: 3 additions & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ analyzer:
language:
strict-casts: true
errors:
inference_failure_on_collection_literal: ignore
inference_failure_on_untyped_parameter: ignore
inference_failure_on_function_invocation: ignore
lines_longer_than_80_chars: ignore

linter:
rules:
- avoid_bool_literals_in_conditional_expressions
- comment_references
- prefer_final_in_for_each
- prefer_final_locals
- prefer_relative_imports
- use_super_parameters
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 @@ -120,7 +120,7 @@ class GetStringsBenchmark extends Benchmark {
String get measureSampleUnits => 'string reads/ms';

static const $id = BenchmarkID.GET_STRINGS;
static final $type = BenchmarkType($id, $create);
static final $type = const BenchmarkType($id, $create);

static GetStringsBenchmark $create(Request r) {
assert(r.params.hasMessageCount());
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 @@ -120,7 +120,7 @@ class HasStringsBenchmark extends Benchmark {
String get measureSampleUnits => 'string reads/ms';

static const $id = BenchmarkID.HAS_STRINGS;
static final $type = BenchmarkType($id, $create);
static final $type = const BenchmarkType($id, $create);

static HasStringsBenchmark $create(Request r) {
assert(r.params.hasMessageCount());
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 @@ -74,7 +74,7 @@ class Int32Benchmark extends Benchmark {
String get measureSampleUnits => 'int32 reads/ms';

static const $id = BenchmarkID.READ_INT32_FIELDS_JSON;
static final $type = BenchmarkType($id, $create);
static final $type = const BenchmarkType($id, $create);

static Int32Benchmark $create(Request r) {
assert(r.params.hasInt32FieldCount());
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 @@ -76,7 +76,7 @@ class Int64Benchmark extends Benchmark {
String get measureSampleUnits => 'int64 reads/ms';

static const $id = BenchmarkID.READ_INT64_FIELDS_JSON;
static final $type = BenchmarkType($id, $create);
static final $type = const BenchmarkType($id, $create);

static Int64Benchmark $create(Request r) {
assert(r.params.hasInt64FieldCount());
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 @@ -66,7 +66,7 @@ class RepeatedInt32Benchmark extends Benchmark {
String get measureSampleUnits => 'int32 reads/ms';

static const $id = BenchmarkID.READ_INT32_REPEATED_JSON;
static final $type = BenchmarkType($id, $create);
static final $type = const BenchmarkType($id, $create);
static RepeatedInt32Benchmark $create(Request r) {
assert(r.params.hasInt32RepeatCount());
assert(r.params.hasMessageCount());
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 @@ -68,7 +68,7 @@ class RepeatedInt64Benchmark extends Benchmark {
String get measureSampleUnits => 'int64 reads/ms';

static const $id = BenchmarkID.READ_INT64_REPEATED_JSON;
static final $type = BenchmarkType($id, $create);
static final $type = const BenchmarkType($id, $create);
static RepeatedInt64Benchmark $create(Request r) {
assert(r.params.hasInt64RepeatCount());
assert(r.params.hasMessageCount());
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 @@ -76,7 +76,7 @@ class RepeatedStringBenchmark extends Benchmark {
String get measureSampleUnits => 'string reads/ms';

static const $id = BenchmarkID.READ_STRING_REPEATED_JSON;
static final $type = BenchmarkType($id, $create);
static final $type = const BenchmarkType($id, $create);

static RepeatedStringBenchmark $create(Request r) {
assert(r.params.hasStringFieldCount());
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 @@ -94,7 +94,7 @@ class SetStringsBenchmark extends Benchmark {
String get measureSampleUnits => 'string writes/ms';

static const $id = BenchmarkID.SET_STRINGS;
static final $type = BenchmarkType($id, $create);
static final $type = const BenchmarkType($id, $create);

static SetStringsBenchmark $create(Request r) {
assert(r.params.hasMessageCount());
Expand Down
2 changes: 1 addition & 1 deletion api_benchmark/lib/benchmarks/string_json.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class StringBenchmark extends Benchmark {
String get measureSampleUnits => 'string reads/ms';

static const $id = BenchmarkID.READ_STRING_FIELDS_JSON;
static final $type = BenchmarkType($id, $create);
static final $type = const BenchmarkType($id, $create);

static StringBenchmark $create(Request r) {
assert(r.params.hasStringFieldCount());
Expand Down
4 changes: 2 additions & 2 deletions api_benchmark/lib/dashboard_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,15 @@ class _Label {

class _Button {
final ButtonElement elt;
final _clicks = StreamController.broadcast();
final _clicks = StreamController<bool>.broadcast();
String? _renderedLabel;
bool? _renderedEnabled;

_Button(this.elt) {
elt.onClick.listen((e) => _clicks.add(true));
}

Stream get onClick => _clicks.stream;
Stream<bool> get onClick => _clicks.stream;

void render(String label, bool enabled) {
if (label != _renderedLabel) {
Expand Down
4 changes: 2 additions & 2 deletions api_benchmark/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: Benchmarking a number of different api calls.
publish_to: none

environment:
sdk: '>=2.19.0 <3.0.0'
sdk: ^3.3.0

dependencies:
fixnum: any
Expand All @@ -20,7 +20,7 @@ dev_dependencies:
build: ^2.0.0
build_runner: ^2.0.6
build_web_compilers: ^4.0.0
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0
glob: ^2.0.0
protoc_plugin:
path: "../protoc_plugin"
Expand Down
2 changes: 1 addition & 1 deletion api_benchmark/tool/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class _BenchmarkBuilder implements Builder {

await buildStep.writeAsString(
AssetId(buildStep.inputId.package, 'web/data/data.json'),
JsonEncoder.withIndent(' ').convert(data));
const JsonEncoder.withIndent(' ').convert(data));
}

@override
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: Benchmarks various protobuf functions
publish_to: none

environment:
sdk: '>=2.19.0 <3.0.0'
sdk: ^3.3.0

dependencies:
# NB. When bumping benchmark_harness check if `benchmark_base.BenchmarkBase`
Expand All @@ -19,7 +19,7 @@ dependencies:

dev_dependencies:
args: ^2.3.1
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0
path: ^1.8.2
pool: ^1.5.1
protoc_plugin:
Expand Down
2 changes: 2 additions & 0 deletions protobuf/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## 4.0.0-dev

* Require Dart 3.3

* **Breaking:** The following types and members are now removed:

- `PbEventMixin`
Expand Down
Loading
Loading