Flip mockito to rely on internal static analysis rules
(more-or-less the pedantic lints), so that code which lands internally will pass Travis static analysis.
PiperOrigin-RevId: 292614095
diff --git a/analysis_options.yaml b/analysis_options.yaml
index 969b271..928ef97 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,20 +1,4 @@
include: package:pedantic/analysis_options.yaml
-analyzer:
- strong-mode:
- implicit-casts: false
- implicit-dynamic: false
- errors:
- # These are for 2.5.0-dev.2.0 and after
- implicit_dynamic_function: ignore
- implicit_dynamic_list_literal: ignore
- implicit_dynamic_map_literal: ignore
- implicit_dynamic_parameter: ignore
- implicit_dynamic_variable: ignore
- # These are pre-2.5.0-dev.2.0
- strong_mode_implicit_dynamic_list_literal: ignore
- strong_mode_implicit_dynamic_map_literal: ignore
- strong_mode_implicit_dynamic_parameter: ignore
- strong_mode_implicit_dynamic_variable: ignore
linter:
rules:
# Errors
diff --git a/lib/src/builder.dart b/lib/src/builder.dart
index 6b8e1e0..2d38275 100644
--- a/lib/src/builder.dart
+++ b/lib/src/builder.dart
@@ -370,8 +370,7 @@
/// Returns a [Parameter] which matches [parameter].
Parameter _matchingParameter(ParameterElement parameter,
{String defaultName}) {
- String name =
- parameter.name?.isEmpty ?? false ? defaultName : parameter.name;
+ var name = parameter.name?.isEmpty ?? false ? defaultName : parameter.name;
return Parameter((pBuilder) {
pBuilder
..name = name
@@ -465,8 +464,9 @@
trBuilder
..symbol = typedef.name
..url = _typeImport(type);
- for (var typeArgument in type.typeArguments)
+ for (var typeArgument in type.typeArguments) {
trBuilder.types.add(_typeReference(typeArgument));
+ }
});
} else {
return refer(type.displayName, _typeImport(type));
diff --git a/lib/src/mock.dart b/lib/src/mock.dart
index fb68a16..6552a1d 100644
--- a/lib/src/mock.dart
+++ b/lib/src/mock.dart
@@ -806,11 +806,15 @@
///
/// Named arguments are listed in the order they are captured in, not the
/// order in which they were passed.
+ // TODO(https://github.com/dart-lang/linter/issues/1992): Remove ignore
+ // comments below when google3 has linter with this bug fixed.
+ // ignore: unnecessary_getters_setters
List<dynamic> get captured => _captured;
@Deprecated(
'captured should be considered final - assigning this field may be '
'removed as early as Mockito 5.0.0')
+ // ignore: unnecessary_getters_setters
set captured(List<dynamic> captured) => _captured = captured;
/// The number of calls matched in this verification.
diff --git a/test/nnbd_support_test.dart b/test/nnbd_support_test.dart
index ed36543..91f2639 100644
--- a/test/nnbd_support_test.dart
+++ b/test/nnbd_support_test.dart
@@ -24,6 +24,7 @@
}
class MockFoo extends Mock implements Foo {
+ @override
String /*!*/ returnsNonNullableString() {
return super.noSuchMethod(
Invocation.method(#returnsNonNullableString, []), 'Dummy');