various analysis updates

This commit is contained in:
Devon Carew 2025-01-22 11:21:58 -08:00
parent 9a9c01752c
commit 54dc394405
No known key found for this signature in database
GPG Key ID: 301D7E534BF0F42E
8 changed files with 33 additions and 36 deletions

View File

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

View File

@ -1,23 +1,22 @@
# https://dart.dev/guides/language/analysis-options
include: package:lints/recommended.yaml
analyzer:
errors:
# These should be fixed or ignored in the proto generator
# These should be fixed or ignored in the proto generator.
implementation_imports: ignore
no_leading_underscores_for_local_identifiers: ignore
unintended_html_in_doc_comment: ignore
linter:
rules:
#true
always_declare_return_types: true
cancel_subscriptions: true
close_sinks: true
directives_ordering: true
omit_local_variable_types: true
prefer_final_locals: true
prefer_single_quotes: true
test_types_in_equals: true
prefer_relative_imports: true
#false
unintended_html_in_doc_comment: false
- always_declare_return_types
- cancel_subscriptions
- close_sinks
- directives_ordering
- omit_local_variable_types
- prefer_final_locals
- prefer_relative_imports
- prefer_single_quotes
# Enable once 3.7 is stable.
# - strict_top_level_inference
- test_types_in_equals

View File

@ -203,7 +203,7 @@ class ClientCall<Q, R> implements Response {
}
}
void onConnectionError(error) {
void onConnectionError(Object error) {
_terminateWithError(GrpcError.unavailable('Error connecting: $error'));
}
@ -398,7 +398,7 @@ class ClientCall<Q, R> implements Response {
/// Handler for response errors. Forward the error to the [_responses] stream,
/// wrapped if necessary.
void _onResponseError(error, StackTrace stackTrace) {
void _onResponseError(Object error, StackTrace stackTrace) {
if (error is GrpcError) {
_responseError(error, stackTrace);
return;
@ -436,7 +436,7 @@ class ClientCall<Q, R> implements Response {
/// Error handler for the requests stream. Something went wrong while trying
/// to send the request to the server. Abort the request, and forward the
/// error to the user code on the [_responses] stream.
void _onRequestError(error, StackTrace stackTrace) {
void _onRequestError(Object error, StackTrace stackTrace) {
if (error is! GrpcError) {
error = GrpcError.unknown(error.toString());
}

View File

@ -271,7 +271,7 @@ class Http2ClientConnection implements connection.ClientConnection {
return _pendingCalls.isNotEmpty;
}
void _handleConnectionFailure(error) {
void _handleConnectionFailure(Object error) {
_disconnect();
if (_state == ConnectionState.shutdown || _state == ConnectionState.idle) {
return;

View File

@ -309,7 +309,7 @@ class ServerHandler extends ServiceCall {
// -- Active state, outgoing response data --
void _onResponse(response) {
void _onResponse(dynamic response) {
try {
final bytes = _descriptor.serialize(response);
if (!_headersSent) {
@ -333,7 +333,7 @@ class ServerHandler extends ServiceCall {
sendTrailers();
}
void _onResponseError(error, trace) {
void _onResponseError(Object error, StackTrace trace) {
if (error is GrpcError) {
_sendError(error, trace);
} else {
@ -413,7 +413,7 @@ class ServerHandler extends ServiceCall {
// -- All states, incoming error / stream closed --
void _onError(error) {
void _onError(Object error) {
// Exception from the incoming stream. Most likely a cancel request from the
// client, so we treat it as such.
_timeoutTimer?.cancel();

View File

@ -1,9 +1,13 @@
name: grpc
description: Dart implementation of gRPC, a high performance, open-source universal RPC framework.
version: 4.0.2-wip
description: Dart implementation of gRPC, a high performance, open-source universal RPC framework.
repository: https://github.com/grpc/grpc-dart
topics:
- grpc
- protocols
- rpc
environment:
sdk: ^3.5.0
@ -31,10 +35,5 @@ dev_dependencies:
fake_async: ^1.3.1
false_secrets:
- interop/server1.key
- test/data/localhost.key
topics:
- grpc
- rpc
- protocols
- interop/server1.key
- test/data/localhost.key

View File

@ -77,7 +77,7 @@ class ClientData {
{required this.address, required this.port, required this.sendPort});
}
void client(clientData) async {
void client(ClientData clientData) async {
final channel = grpc.ClientChannel(
clientData.address,
port: clientData.port,
@ -107,7 +107,7 @@ Future<void> main() async {
]);
await server.serve(address: address, port: 0);
final receivePort = ReceivePort();
Isolate.spawn(
Isolate.spawn<ClientData>(
client,
ClientData(
address: address,

View File

@ -137,7 +137,7 @@ void checkFinishEvent(List<Map> events) {
expect(e.length, 2);
}
void main([args = const <String>[]]) {
void main(List<String> args) {
test('Test gRPC timeline logging', () async {
final vmService = await testee();
final timeline = await vmService.getVMTimeline();