refactor(mocktail): upgrade analysis_options.yaml (#242)

This commit is contained in:
Felix Angelov
2024-06-11 22:26:22 -05:00
committed by GitHub
parent 8a7bd295d9
commit 80a8db5094
2 changed files with 18 additions and 16 deletions

View File

@ -92,6 +92,7 @@ linter:
- no_leading_underscores_for_local_identifiers - no_leading_underscores_for_local_identifiers
- no_logic_in_create_state - no_logic_in_create_state
- no_runtimeType_toString - no_runtimeType_toString
- no_wildcard_variable_uses
- non_constant_identifier_names - non_constant_identifier_names
- noop_primitive_operations - noop_primitive_operations
- null_check_on_nullable_type_parameter - null_check_on_nullable_type_parameter
@ -153,6 +154,7 @@ linter:
- tighten_type_of_initializing_formals - tighten_type_of_initializing_formals
- type_annotate_public_apis - type_annotate_public_apis
- type_init_formals - type_init_formals
- type_literal_in_constant_pattern
- unawaited_futures - unawaited_futures
- unnecessary_await_in_return - unnecessary_await_in_return
- unnecessary_brace_in_string_interps - unnecessary_brace_in_string_interps

View File

@ -206,11 +206,11 @@ When<T> Function<T>(T Function() x) get when {
throw StateError('Cannot call `when` within a stub response'); throw StateError('Cannot call `when` within a stub response');
} }
_whenInProgress = true; _whenInProgress = true;
return <T>(T Function() _) { return <T>(T Function() fn) {
try { try {
_(); fn();
} catch (_) { } catch (e) {
if (_ is! TypeError) rethrow; if (e is! TypeError) rethrow;
} }
_whenInProgress = false; _whenInProgress = false;
return When<T>(); return When<T>();
@ -395,12 +395,12 @@ List<VerificationResult> Function<T>(
throw StateError(_verifyCalls.join()); throw StateError(_verifyCalls.join());
} }
_verificationInProgress = true; _verificationInProgress = true;
return <T>(List<T Function()> _) { return <T>(List<T Function()> invocations) {
for (final invocation in _) { for (final invocation in invocations) {
try { try {
invocation(); invocation();
} catch (_) { } catch (e) {
if (_ is! TypeError) rethrow; if (e is! TypeError) rethrow;
} }
} }
@ -503,11 +503,11 @@ Verify _makeVerify(bool never) {
); );
} }
_verificationInProgress = true; _verificationInProgress = true;
return <T>(T Function() mock) { return <T>(T Function() fn) {
try { try {
mock(); fn();
} catch (_) { } catch (e) {
if (_ is! TypeError) rethrow; if (e is! TypeError) rethrow;
} }
_verificationInProgress = false; _verificationInProgress = false;
if (_verifyCalls.length == 1) { if (_verifyCalls.length == 1) {
@ -758,11 +758,11 @@ class _VerifyCall {
/// future will return immediately. /// future will return immediately.
Future<Invocation> Function<T>(T Function() _) get untilCalled { Future<Invocation> Function<T>(T Function() _) get untilCalled {
_untilCalledInProgress = true; _untilCalledInProgress = true;
return <T>(T Function() _) { return <T>(T Function() fn) {
try { try {
_(); fn();
} catch (_) { } catch (e) {
if (_ is! TypeError) rethrow; if (e is! TypeError) rethrow;
} }
_untilCalledInProgress = false; _untilCalledInProgress = false;
return _untilCall!.invocationFuture; return _untilCall!.invocationFuture;