Skip to content

Commit 7f9042f

Browse files
devoncarewmosuem
andauthored
various analysis updates (#755)
* various analysis updates * misc updates * remove unintentional dartdoc comment * Update CONTRIBUTING.md Co-authored-by: Moritz <[email protected]> * add ignore comments for use of deprecated apis --------- Co-authored-by: Moritz <[email protected]>
1 parent 9a9c017 commit 7f9042f

15 files changed

+43
-42
lines changed

CONTRIBUTING.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,15 @@ it should raise analysis issues as you edit; alternatively validate from the
2525
Terminal:
2626

2727
```
28-
dartanalyzer lib test
28+
dart analyze
2929
```
3030

3131
All analysis warnings and errors must be fixed; hints should be considered.
3232

3333
## Running tests
3434

3535
```
36-
pub get
37-
pub run test
36+
dart test
3837
```
3938

4039
gRPC-web tests require [`envoy`](
@@ -69,4 +68,4 @@ early on.
6968
so.
7069

7170
## Updating protobuf definitions
72-
Sometimes we might need to update the generated dart files from the protos included in `lib/src/protos`. To do this, run the script `tool/regenerate.sh` from the project root and it will update the generated dart files in `lib/src/geneerated`.
71+
Sometimes we might need to update the generated dart files from the protos included in `lib/src/protos`. To do this, run the script `tool/regenerate.sh` from the project root and it will update the generated dart files in `lib/src/generated`.

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
The [Dart](https://www.dart.dev/) implementation of
2-
[gRPC](https://grpc.io/): A high performance, open source, general RPC framework that puts mobile and HTTP/2 first.
3-
41
[![Dart](https://github.com/grpc/grpc-dart/actions/workflows/dart.yml/badge.svg)](https://github.com/grpc/grpc-dart/actions/workflows/dart.yml)
52
[![pub package](https://img.shields.io/pub/v/grpc.svg)](https://pub.dev/packages/grpc)
63

4+
The [Dart](https://www.dart.dev/) implementation of
5+
[gRPC](https://grpc.io/): A high performance, open source, general RPC framework that puts mobile and HTTP/2 first.
76

87
## Learn more
98

analysis_options.yaml

+13-14
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
# https://dart.dev/guides/language/analysis-options
21
include: package:lints/recommended.yaml
32

43
analyzer:
54
errors:
6-
# These should be fixed or ignored in the proto generator
5+
# These should be fixed or ignored in the proto generator.
76
implementation_imports: ignore
87
no_leading_underscores_for_local_identifiers: ignore
8+
unintended_html_in_doc_comment: ignore
99

1010
linter:
1111
rules:
12-
#true
13-
always_declare_return_types: true
14-
cancel_subscriptions: true
15-
close_sinks: true
16-
directives_ordering: true
17-
omit_local_variable_types: true
18-
prefer_final_locals: true
19-
prefer_single_quotes: true
20-
test_types_in_equals: true
21-
prefer_relative_imports: true
22-
#false
23-
unintended_html_in_doc_comment: false
12+
- always_declare_return_types
13+
- cancel_subscriptions
14+
- close_sinks
15+
- directives_ordering
16+
- omit_local_variable_types
17+
- prefer_final_locals
18+
- prefer_relative_imports
19+
- prefer_single_quotes
20+
# Enable once 3.7 is stable.
21+
# - strict_top_level_inference
22+
- test_types_in_equals

example/grpc-web/lib/app.dart

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// limitations under the License.
1515

1616
import 'dart:async';
17+
// ignore: deprecated_member_use (#756)
1718
import 'dart:html';
1819

1920
import 'src/generated/echo.pbgrpc.dart';

example/grpc-web/web/main.dart

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
15+
16+
// ignore: deprecated_member_use (#756)
1517
import 'dart:html';
1618

1719
import 'package:grpc/grpc_web.dart';

lib/grpc.dart

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
1515

16-
// ignore: dangling_library_doc_comments
17-
/// Status detail types and error codes
1816
export 'package:grpc/src/generated/google/rpc/error_details.pb.dart';
1917

2018
export 'src/auth/auth.dart' show BaseAuthenticator;

lib/src/client/call.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class ClientCall<Q, R> implements Response {
203203
}
204204
}
205205

206-
void onConnectionError(error) {
206+
void onConnectionError(Object error) {
207207
_terminateWithError(GrpcError.unavailable('Error connecting: $error'));
208208
}
209209

@@ -398,7 +398,7 @@ class ClientCall<Q, R> implements Response {
398398

399399
/// Handler for response errors. Forward the error to the [_responses] stream,
400400
/// wrapped if necessary.
401-
void _onResponseError(error, StackTrace stackTrace) {
401+
void _onResponseError(Object error, StackTrace stackTrace) {
402402
if (error is GrpcError) {
403403
_responseError(error, stackTrace);
404404
return;
@@ -436,7 +436,7 @@ class ClientCall<Q, R> implements Response {
436436
/// Error handler for the requests stream. Something went wrong while trying
437437
/// to send the request to the server. Abort the request, and forward the
438438
/// error to the user code on the [_responses] stream.
439-
void _onRequestError(error, StackTrace stackTrace) {
439+
void _onRequestError(Object error, StackTrace stackTrace) {
440440
if (error is! GrpcError) {
441441
error = GrpcError.unknown(error.toString());
442442
}

lib/src/client/http2_connection.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ class Http2ClientConnection implements connection.ClientConnection {
271271
return _pendingCalls.isNotEmpty;
272272
}
273273

274-
void _handleConnectionFailure(error) {
274+
void _handleConnectionFailure(Object error) {
275275
_disconnect();
276276
if (_state == ConnectionState.shutdown || _state == ConnectionState.idle) {
277277
return;

lib/src/client/transport/xhr_transport.dart

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// limitations under the License.
1515

1616
import 'dart:async';
17+
// ignore: deprecated_member_use (#756)
1718
import 'dart:html';
1819
import 'dart:typed_data';
1920

lib/src/server/handler.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ class ServerHandler extends ServiceCall {
309309

310310
// -- Active state, outgoing response data --
311311

312-
void _onResponse(response) {
312+
void _onResponse(dynamic response) {
313313
try {
314314
final bytes = _descriptor.serialize(response);
315315
if (!_headersSent) {
@@ -333,7 +333,7 @@ class ServerHandler extends ServiceCall {
333333
sendTrailers();
334334
}
335335

336-
void _onResponseError(error, trace) {
336+
void _onResponseError(Object error, StackTrace trace) {
337337
if (error is GrpcError) {
338338
_sendError(error, trace);
339339
} else {
@@ -413,7 +413,7 @@ class ServerHandler extends ServiceCall {
413413

414414
// -- All states, incoming error / stream closed --
415415

416-
void _onError(error) {
416+
void _onError(Object error) {
417417
// Exception from the incoming stream. Most likely a cancel request from the
418418
// client, so we treat it as such.
419419
_timeoutTimer?.cancel();

lib/src/shared/io_bits/io_bits_web.dart

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
1515

16+
// ignore: deprecated_member_use (#756)
1617
export 'dart:html' show HttpStatus;
1718

1819
/// Unavailable on the web

pubspec.yaml

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
name: grpc
2-
description: Dart implementation of gRPC, a high performance, open-source universal RPC framework.
32
version: 4.0.2-wip
4-
3+
description: Dart implementation of gRPC, a high performance, open-source universal RPC framework.
54
repository: https://github.com/grpc/grpc-dart
65

6+
topics:
7+
- grpc
8+
- protocols
9+
- rpc
10+
711
environment:
812
sdk: ^3.5.0
913

@@ -31,10 +35,5 @@ dev_dependencies:
3135
fake_async: ^1.3.1
3236

3337
false_secrets:
34-
- interop/server1.key
35-
- test/data/localhost.key
36-
37-
topics:
38-
- grpc
39-
- rpc
40-
- protocols
38+
- interop/server1.key
39+
- test/data/localhost.key

test/client_tests/client_xhr_transport_test.dart

+2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
15+
1516
@TestOn('browser')
1617
library;
1718

1819
import 'dart:async';
20+
// ignore: deprecated_member_use (#756)
1921
import 'dart:html';
2022

2123
import 'package:async/async.dart';

test/server_handles_broken_connection_test.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class ClientData {
7777
{required this.address, required this.port, required this.sendPort});
7878
}
7979

80-
void client(clientData) async {
80+
void client(ClientData clientData) async {
8181
final channel = grpc.ClientChannel(
8282
clientData.address,
8383
port: clientData.port,
@@ -107,7 +107,7 @@ Future<void> main() async {
107107
]);
108108
await server.serve(address: address, port: 0);
109109
final receivePort = ReceivePort();
110-
Isolate.spawn(
110+
Isolate.spawn<ClientData>(
111111
client,
112112
ClientData(
113113
address: address,

test/timeline_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void checkFinishEvent(List<Map> events) {
137137
expect(e.length, 2);
138138
}
139139

140-
void main([args = const <String>[]]) {
140+
void main(List<String> args) {
141141
test('Test gRPC timeline logging', () async {
142142
final vmService = await testee();
143143
final timeline = await vmService.getVMTimeline();

0 commit comments

Comments
 (0)