From a1ed0647fddda5b21eeaafd24ed8bbb18217c09b Mon Sep 17 00:00:00 2001 From: jld3103 Date: Wed, 4 Oct 2023 12:21:46 +0200 Subject: [PATCH] refactor: Cleanup ignore_for_file's Signed-off-by: jld3103 --- .../dynamite_runtime/test/content_string_test.dart | 6 +++--- packages/neon/neon/test/app_implementation_test.dart | 4 +--- packages/neon/neon/test/disposable_test.dart | 4 ++-- packages/neon/neon/test/settings_export_test.dart | 9 ++++----- packages/neon/neon/test/stream_listenable_test.dart | 12 +++++------- packages/neon/neon/test/timer_bloc_test.dart | 6 ++---- packages/neon/neon_files/lib/utils/task.dart | 12 ++++-------- packages/nextcloud/test/helper.dart | 4 +--- 8 files changed, 22 insertions(+), 35 deletions(-) diff --git a/packages/dynamite/dynamite_runtime/test/content_string_test.dart b/packages/dynamite/dynamite_runtime/test/content_string_test.dart index 5100fdb3..2e87c378 100644 --- a/packages/dynamite/dynamite_runtime/test/content_string_test.dart +++ b/packages/dynamite/dynamite_runtime/test/content_string_test.dart @@ -1,4 +1,4 @@ -// ignore_for_file: avoid_redundant_argument_values, inference_failure_on_instance_creation +// ignore_for_file: avoid_redundant_argument_values import 'dart:convert'; @@ -131,7 +131,7 @@ void main() { }); group('ContentString with unknown specifiedType holding list', () { - final data = ContentString((final b) => b..content = BuiltList([1, 2, 3])); + final data = ContentString((final b) => b..content = BuiltList([1, 2, 3])); final serialized = json.decode( json.encode({ r'$': 'ContentString', @@ -176,7 +176,7 @@ void main() { }); group('ContentString with unknown specifiedType holding map', () { - final data = ContentString((final b) => b..content = BuiltMap({'one': 1, 'two': 2, 'three': 3})); + final data = ContentString((final b) => b..content = BuiltMap({'one': 1, 'two': 2, 'three': 3})); final serialized = json.decode( json.encode({ r'$': 'ContentString', diff --git a/packages/neon/neon/test/app_implementation_test.dart b/packages/neon/neon/test/app_implementation_test.dart index 9564ca68..487f5229 100644 --- a/packages/neon/neon/test/app_implementation_test.dart +++ b/packages/neon/neon/test/app_implementation_test.dart @@ -1,10 +1,8 @@ -// ignore_for_file: avoid_implementing_value_types - import 'package:mocktail/mocktail.dart'; import 'package:neon/src/models/app_implementation.dart'; import 'package:test/test.dart'; -// ignore: missing_override_of_must_be_overridden +// ignore: missing_override_of_must_be_overridden, avoid_implementing_value_types class AppImplementationMock extends Mock implements AppImplementation {} void main() { diff --git a/packages/neon/neon/test/disposable_test.dart b/packages/neon/neon/test/disposable_test.dart index 66e53129..453c8a8b 100644 --- a/packages/neon/neon/test/disposable_test.dart +++ b/packages/neon/neon/test/disposable_test.dart @@ -1,5 +1,3 @@ -// ignore_for_file: cascade_invocations - import 'package:mocktail/mocktail.dart'; import 'package:neon/src/models/disposable.dart'; import 'package:test/test.dart'; @@ -18,6 +16,7 @@ void main() { disposable3, ]; + // ignore: cascade_invocations list.disposeAll(); verify(disposable0.dispose).called(1); @@ -30,6 +29,7 @@ void main() { 'disposable3': disposable3, }; + // ignore: cascade_invocations map.disposeAll(); verify(disposable0.dispose).called(1); diff --git a/packages/neon/neon/test/settings_export_test.dart b/packages/neon/neon/test/settings_export_test.dart index 83fb68ac..4afb95fb 100644 --- a/packages/neon/neon/test/settings_export_test.dart +++ b/packages/neon/neon/test/settings_export_test.dart @@ -1,5 +1,3 @@ -// ignore_for_file: avoid_implementing_value_types, inference_failure_on_collection_literal - import 'dart:convert'; import 'dart:typed_data'; @@ -14,13 +12,14 @@ import 'package:neon/src/utils/account_options.dart'; import 'package:rxdart/rxdart.dart'; import 'package:test/test.dart'; -// ignore: missing_override_of_must_be_overridden +// ignore: missing_override_of_must_be_overridden, avoid_implementing_value_types class FakeAppImplementation extends Mock implements AppImplementation {} class NextcloudAppOptionsMock extends Mock implements NextcloudAppOptions {} class AccountsBlocMock extends Mock implements AccountsBloc {} +// ignore: avoid_implementing_value_types class FakeAccount extends Mock implements Account {} class AccountSpecificOptionsMock extends Mock implements AccountSpecificOptions {} @@ -33,7 +32,7 @@ void main() { var exporter = const AppImplementationsExporter([]); var export = exporter.export(); - expect(Map.fromEntries([export]), {'app': {}}); + expect(Map.fromEntries([export]), {'app': {}}); final fakeApp = FakeAppImplementation(); final fakeOptions = NextcloudAppOptionsMock(); @@ -66,7 +65,7 @@ void main() { when(() => bloc.accounts).thenAnswer((final _) => BehaviorSubject.seeded([])); var export = exporter.export(); - expect(Map.fromEntries([export]), {'accounts': {}}); + expect(Map.fromEntries([export]), {'accounts': {}}); final fakeAccount = FakeAccount(); final fakeOptions = AccountSpecificOptionsMock(); diff --git a/packages/neon/neon/test/stream_listenable_test.dart b/packages/neon/neon/test/stream_listenable_test.dart index 4b6294f7..7087cadf 100644 --- a/packages/neon/neon/test/stream_listenable_test.dart +++ b/packages/neon/neon/test/stream_listenable_test.dart @@ -1,5 +1,3 @@ -// ignore_for_file: unreachable_from_main, inference_failure_on_instance_creation - import 'dart:async'; import 'package:mocktail/mocktail.dart'; @@ -22,11 +20,11 @@ void main() { verifyNever(callback.call); stream.value = true; - await Future.delayed(const Duration(milliseconds: 100)); + await Future.delayed(const Duration(milliseconds: 100)); verify(callback.call).called(1); stream.value = true; - await Future.delayed(const Duration(milliseconds: 100)); + await Future.delayed(const Duration(milliseconds: 100)); verify(callback.call).called(1); unawaited(stream.close()); @@ -45,11 +43,11 @@ void main() { verifyNever(callback.call); stream.value = true; - await Future.delayed(const Duration(milliseconds: 100)); + await Future.delayed(const Duration(milliseconds: 100)); verify(callback.call).called(1); stream2.value = 3; - await Future.delayed(const Duration(milliseconds: 100)); + await Future.delayed(const Duration(milliseconds: 100)); verify(callback.call).called(1); unawaited(stream.close()); @@ -57,7 +55,7 @@ void main() { }); test('dispose', () { - final controller = StreamController(); + final controller = StreamController(); final listenable = StreamListenable(controller.stream); diff --git a/packages/neon/neon/test/timer_bloc_test.dart b/packages/neon/neon/test/timer_bloc_test.dart index 1d8a0c48..01fdf6d6 100644 --- a/packages/neon/neon/test/timer_bloc_test.dart +++ b/packages/neon/neon/test/timer_bloc_test.dart @@ -1,5 +1,3 @@ -// ignore_for_file: inference_failure_on_instance_creation - import 'package:neon/blocs.dart'; import 'package:test/test.dart'; @@ -15,7 +13,7 @@ void main() { final stopwatch = Stopwatch()..start(); final callback = stopwatch.stop; TimerBloc().registerTimer(duration, callback); - await Future.delayed(duration); + await Future.delayed(duration); expect(stopwatch.elapsedMilliseconds, greaterThan(duration.inMilliseconds)); expect(stopwatch.elapsedMilliseconds, lessThan(duration.inMilliseconds * 2)); @@ -28,7 +26,7 @@ void main() { final callback = neverCalled; TimerBloc().registerTimer(duration, callback).cancel(); - await Future.delayed(duration); + await Future.delayed(duration); expect(TimerBloc().callbacks[duration.inSeconds], isNot(contains(callback))); }); diff --git a/packages/neon/neon_files/lib/utils/task.dart b/packages/neon/neon_files/lib/utils/task.dart index 59da283d..4d3c9fcc 100644 --- a/packages/neon/neon_files/lib/utils/task.dart +++ b/packages/neon/neon_files/lib/utils/task.dart @@ -1,5 +1,3 @@ -// ignore_for_file: unnecessary_lambdas - part of '../neon_files.dart'; sealed class FilesTask { @@ -29,10 +27,9 @@ class FilesDownloadTask extends FilesTask { await client.webdav.getFile( Uri(pathSegments: path), file, - onProgress: (final progress) { - streamController.add(progress); - }, + onProgress: streamController.add, ); + await streamController.close(); } } @@ -51,9 +48,8 @@ class FilesUploadTask extends FilesTask { stat, Uri(pathSegments: path), lastModified: stat.modified, - onProgress: (final progress) { - streamController.add(progress); - }, + onProgress: streamController.add, ); + await streamController.close(); } } diff --git a/packages/nextcloud/test/helper.dart b/packages/nextcloud/test/helper.dart index 00f4cb75..8f0fc6d8 100644 --- a/packages/nextcloud/test/helper.dart +++ b/packages/nextcloud/test/helper.dart @@ -1,5 +1,3 @@ -// ignore_for_file: inference_failure_on_instance_creation - import 'dart:async'; import 'dart:convert'; import 'dart:io'; @@ -143,7 +141,7 @@ Future getTestClient( break; } on DynamiteApiException catch (error) { i++; - await Future.delayed(const Duration(milliseconds: 100)); + await Future.delayed(const Duration(milliseconds: 100)); if (i >= 30) { throw TimeoutException('Failed to get the status of the Server. $error'); }