Skip to content

Commit 80a8db5

Browse files
authored
refactor(mocktail): upgrade analysis_options.yaml (#242)
1 parent 8a7bd29 commit 80a8db5

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

analysis_options.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ linter:
9292
- no_leading_underscores_for_local_identifiers
9393
- no_logic_in_create_state
9494
- no_runtimeType_toString
95+
- no_wildcard_variable_uses
9596
- non_constant_identifier_names
9697
- noop_primitive_operations
9798
- null_check_on_nullable_type_parameter
@@ -153,6 +154,7 @@ linter:
153154
- tighten_type_of_initializing_formals
154155
- type_annotate_public_apis
155156
- type_init_formals
157+
- type_literal_in_constant_pattern
156158
- unawaited_futures
157159
- unnecessary_await_in_return
158160
- unnecessary_brace_in_string_interps

packages/mocktail/lib/src/mocktail.dart

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,11 @@ When<T> Function<T>(T Function() x) get when {
206206
throw StateError('Cannot call `when` within a stub response');
207207
}
208208
_whenInProgress = true;
209-
return <T>(T Function() _) {
209+
return <T>(T Function() fn) {
210210
try {
211-
_();
212-
} catch (_) {
213-
if (_ is! TypeError) rethrow;
211+
fn();
212+
} catch (e) {
213+
if (e is! TypeError) rethrow;
214214
}
215215
_whenInProgress = false;
216216
return When<T>();
@@ -395,12 +395,12 @@ List<VerificationResult> Function<T>(
395395
throw StateError(_verifyCalls.join());
396396
}
397397
_verificationInProgress = true;
398-
return <T>(List<T Function()> _) {
399-
for (final invocation in _) {
398+
return <T>(List<T Function()> invocations) {
399+
for (final invocation in invocations) {
400400
try {
401401
invocation();
402-
} catch (_) {
403-
if (_ is! TypeError) rethrow;
402+
} catch (e) {
403+
if (e is! TypeError) rethrow;
404404
}
405405
}
406406

@@ -503,11 +503,11 @@ Verify _makeVerify(bool never) {
503503
);
504504
}
505505
_verificationInProgress = true;
506-
return <T>(T Function() mock) {
506+
return <T>(T Function() fn) {
507507
try {
508-
mock();
509-
} catch (_) {
510-
if (_ is! TypeError) rethrow;
508+
fn();
509+
} catch (e) {
510+
if (e is! TypeError) rethrow;
511511
}
512512
_verificationInProgress = false;
513513
if (_verifyCalls.length == 1) {
@@ -758,11 +758,11 @@ class _VerifyCall {
758758
/// future will return immediately.
759759
Future<Invocation> Function<T>(T Function() _) get untilCalled {
760760
_untilCalledInProgress = true;
761-
return <T>(T Function() _) {
761+
return <T>(T Function() fn) {
762762
try {
763-
_();
764-
} catch (_) {
765-
if (_ is! TypeError) rethrow;
763+
fn();
764+
} catch (e) {
765+
if (e is! TypeError) rethrow;
766766
}
767767
_untilCalledInProgress = false;
768768
return _untilCall!.invocationFuture;

0 commit comments

Comments
 (0)