-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please add // ignore_for_file: unnecessary_overrides to generated files or do not generate toString() overrides #461
Comments
Thanks for the report. Can you please include:
|
Hi, I'm currently using
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:mockito/annotations.dart';
import 'my_test.mocks.dart';
@GenerateMocks([Connectivity])
void main() {
final mockConnectivity = MockConnectivity();
}
// Mocks generated by Mockito 5.0.14 from annotations
// in wallpaper_app/test/extra/network/my_test.dart.
// Do not manually edit this file.
import 'dart:async' as _i3;
import 'package:connectivity_plus/connectivity_plus.dart' as _i2;
import 'package:connectivity_plus_platform_interface/connectivity_plus_platform_interface.dart'
as _i4;
import 'package:mockito/mockito.dart' as _i1;
// ignore_for_file: avoid_redundant_argument_values
// ignore_for_file: avoid_setters_without_getters
// ignore_for_file: comment_references
// ignore_for_file: implementation_imports
// ignore_for_file: invalid_use_of_visible_for_testing_member
// ignore_for_file: prefer_const_constructors
// ignore_for_file: unnecessary_parenthesis
/// A class which mocks [Connectivity].
///
/// See the documentation for Mockito's code generation for more information.
class MockConnectivity extends _i1.Mock implements _i2.Connectivity {
MockConnectivity() {
_i1.throwOnMissingStub(this);
}
@override
_i3.Stream<_i4.ConnectivityResult> get onConnectivityChanged =>
(super.noSuchMethod(Invocation.getter(#onConnectivityChanged),
returnValue: Stream<_i4.ConnectivityResult>.empty())
as _i3.Stream<_i4.ConnectivityResult>);
@override
_i3.Future<_i4.ConnectivityResult> checkConnectivity() => (super.noSuchMethod(
Invocation.method(#checkConnectivity, []),
returnValue:
Future<_i4.ConnectivityResult>.value(_i4.ConnectivityResult.wifi))
as _i3.Future<_i4.ConnectivityResult>);
@override
String toString() => super.toString();
} |
Maybe important to note, this is related to the recommended lints from the |
Same thing but please add an ignore for |
Sorry for the delay and thanks for the repro. I can reproduce. |
Alternatively I've found a better workaround for my project. Instead I just added this to my include: package:lints/recommended.yaml
analyzer:
exclude:
- "**/*.mocks.dart" Then there will be no lint errors in any of the generated mock files. |
Dart 2.16 has support for ignoring all lint errors in a file which mockito takes advantage of. |
Because
is not allowed by strict analyser options
The text was updated successfully, but these errors were encountered: