Remove outdated ignores (#162773)
Powered by the new and amazing `unnecessary_ignore` lint. We're not enabling this lint by default because being able to temporarily use ignores that don't ignore anything is a powerful tool to enable migrations. We should turn this lint on locally periodically, though, and clean up all outdated ignores.
This commit is contained in:
committed by
GitHub
parent
5944d992ac
commit
c783ce2344
@@ -1163,8 +1163,6 @@ class CupertinoDynamicColor with Diagnosticable implements Color {
|
||||
int get value => _effectiveColor.value;
|
||||
|
||||
@override
|
||||
// TODO(matanl): Remove once https://github.com/flutter/engine/pull/56329 lands in the framework.
|
||||
// ignore: override_on_non_overriding_member, public_member_api_docs
|
||||
int toARGB32() => value;
|
||||
|
||||
@override
|
||||
|
||||
@@ -171,10 +171,6 @@ class AutomaticNotchedShape extends NotchedShape {
|
||||
|
||||
@override
|
||||
Path getOuterPath(Rect hostRect, Rect? guestRect) {
|
||||
// ignore: avoid_renaming_method_parameters
|
||||
// The parameters of this method are renamed over the baseclass because they
|
||||
// would clash with properties of this object, and the use of all four of
|
||||
// them in the code below is really confusing if they have the same names.
|
||||
final Path hostPath = host.getOuterPath(hostRect);
|
||||
if (guest != null && guestRect != null) {
|
||||
final Path guestPath = guest!.getOuterPath(guestRect);
|
||||
|
||||
@@ -34,9 +34,9 @@ export 'package:flutter/foundation.dart'
|
||||
visibleForTesting;
|
||||
export 'package:flutter/foundation.dart'
|
||||
show ErrorDescription, ErrorHint, ErrorSummary, FlutterError, debugPrint, debugPrintStack;
|
||||
export 'package:flutter/foundation.dart' show ValueChanged, ValueGetter, ValueSetter, VoidCallback;
|
||||
export 'package:flutter/foundation.dart' show DiagnosticLevel, DiagnosticsNode;
|
||||
export 'package:flutter/foundation.dart' show Key, LocalKey, ValueKey;
|
||||
export 'package:flutter/foundation.dart' show ValueChanged, ValueGetter, ValueSetter, VoidCallback;
|
||||
export 'package:flutter/rendering.dart'
|
||||
show RenderBox, RenderObject, debugDumpLayerTree, debugDumpRenderTree;
|
||||
|
||||
@@ -6947,7 +6947,6 @@ mixin RootElementMixin on Element {
|
||||
/// to [runApp]. The binding is responsible for driving the build pipeline by
|
||||
/// calling the build owner's [BuildOwner.buildScope] method. See
|
||||
/// [WidgetsBinding.drawFrame].
|
||||
// ignore: use_setters_to_change_properties, (API predates enforcing the lint)
|
||||
void assignOwner(BuildOwner owner) {
|
||||
_owner = owner;
|
||||
_parentBuildScope = BuildScope();
|
||||
|
||||
@@ -3748,10 +3748,7 @@ class _Location {
|
||||
required this.file,
|
||||
required this.line,
|
||||
required this.column,
|
||||
// TODO(srawlins): `unused_element_parameter` is being separated from
|
||||
// `unused_element`. Ignore both names until the separation is complete.
|
||||
// ignore: unused_element, unused_element_parameter
|
||||
this.name,
|
||||
this.name, // ignore: unused_element_parameter
|
||||
});
|
||||
|
||||
/// File path of the location.
|
||||
|
||||
@@ -188,7 +188,6 @@ void main() {
|
||||
FlutterError.onError = oldHandler;
|
||||
|
||||
expect(exceptions.length, 1);
|
||||
// ignore: avoid_dynamic_calls
|
||||
expect(exceptions.single.runtimeType, FlutterError);
|
||||
final FlutterError error = exceptions.first as FlutterError;
|
||||
expect(error.diagnostics.length, 5);
|
||||
|
||||
@@ -2475,7 +2475,6 @@ void main() {
|
||||
FlutterError.onError = oldHandler;
|
||||
|
||||
expect(exceptions.length, 1);
|
||||
// ignore: avoid_dynamic_calls
|
||||
expect(exceptions.single.runtimeType, FlutterError);
|
||||
final FlutterError error = exceptions.first as FlutterError;
|
||||
expect(error.diagnostics.length, 5);
|
||||
|
||||
@@ -645,10 +645,7 @@ void main() {
|
||||
RenderObject render = tester.renderObject(
|
||||
find.byWidgetPredicate((Widget w) => '${w.runtimeType}' == '_DayPeriodInputPadding'),
|
||||
);
|
||||
expect(
|
||||
(render as dynamic).orientation,
|
||||
Orientation.portrait,
|
||||
); // ignore: avoid_dynamic_calls
|
||||
expect((render as dynamic).orientation, Orientation.portrait);
|
||||
|
||||
// landscape
|
||||
tester.view.physicalSize = const Size(800.5, 800);
|
||||
|
||||
@@ -391,7 +391,6 @@ class TestPlatformDispatcher implements PlatformDispatcher {
|
||||
bool get supportsShowingSystemContextMenu =>
|
||||
_supportsShowingSystemContextMenu ?? _platformDispatcher.supportsShowingSystemContextMenu;
|
||||
bool? _supportsShowingSystemContextMenu;
|
||||
// ignore: avoid_setters_without_getters
|
||||
set supportsShowingSystemContextMenu(bool value) {
|
||||
_supportsShowingSystemContextMenu = value;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:matcher/expect.dart' as matcher;
|
||||
import 'package:matcher/src/expect/async_matcher.dart'; // ignore: implementation_imports
|
||||
import 'package:matcher/src/expect/async_matcher.dart';
|
||||
|
||||
import 'multi_view_testing.dart';
|
||||
|
||||
|
||||
@@ -326,7 +326,6 @@ class ErrorHandlingFile extends ForwardingFileSystemEntity<File, io.File> with F
|
||||
bytes += chunkLength;
|
||||
}
|
||||
} catch (err) {
|
||||
// ignore: avoid_catches_without_on_clauses, rethrows
|
||||
ErrorHandlingFileSystem.deleteIfExists(resultFile, recursive: true);
|
||||
rethrow;
|
||||
} finally {
|
||||
|
||||
@@ -667,7 +667,6 @@ Future<int> exitWithHooks(int code, {required ShutdownHooks shutdownHooks}) asyn
|
||||
// This catches all exceptions because the error is propagated on the
|
||||
// completer.
|
||||
} catch (error, stackTrace) {
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
completer.completeError(error, stackTrace);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -89,7 +89,6 @@ class _TaskQueueItem<T> {
|
||||
try {
|
||||
_completer.complete(await _closure());
|
||||
} catch (e) {
|
||||
// ignore: avoid_catches_without_on_clauses, forwards to Future
|
||||
_completer.completeError(e);
|
||||
} finally {
|
||||
onComplete?.call();
|
||||
|
||||
@@ -629,7 +629,6 @@ class ReleaseIosApplicationBundle extends _IosAssetBundleWithDSYM {
|
||||
try {
|
||||
await super.build(environment);
|
||||
} catch (_) {
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
buildSuccess = false;
|
||||
rethrow;
|
||||
} finally {
|
||||
|
||||
@@ -706,7 +706,6 @@ class ReleaseMacOSBundleFlutterAssets extends MacOSBundleFlutterAssets {
|
||||
try {
|
||||
await super.build(environment);
|
||||
} catch (_) {
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
buildSuccess = false;
|
||||
rethrow;
|
||||
} finally {
|
||||
|
||||
@@ -357,7 +357,6 @@ class PackagesGetCommand extends FlutterCommand {
|
||||
);
|
||||
// Not limiting to catching Exception because the exception is rethrown.
|
||||
} catch (_) {
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
final Duration elapsedDuration = timer.elapsed;
|
||||
analytics.send(
|
||||
Event.timing(
|
||||
|
||||
@@ -629,7 +629,6 @@ class UpdatePackagesCommand extends FlutterCommand {
|
||||
status.stop();
|
||||
// The exception is rethrown, so don't catch only Exceptions.
|
||||
} catch (exception) {
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
status.cancel();
|
||||
rethrow;
|
||||
}
|
||||
|
||||
@@ -664,7 +664,6 @@ void _validateFlutter(YamlMap? yaml, List<String> errors) {
|
||||
|
||||
for (int i = 0; i < yamlList.length; i++) {
|
||||
if (yamlList[i] is! T) {
|
||||
// ignore: avoid_dynamic_calls
|
||||
errors.add(
|
||||
'Expected $context to be a list of $typeAlias, but element at index $i was a ${yamlList[i].runtimeType}.',
|
||||
);
|
||||
@@ -682,7 +681,6 @@ void _validateDeferredComponents(MapEntry<Object?, Object?> kvp, List<String> er
|
||||
for (int i = 0; i < yamlList.length; i++) {
|
||||
final Object? valueMap = yamlList[i];
|
||||
if (valueMap is! YamlMap) {
|
||||
// ignore: avoid_dynamic_calls
|
||||
errors.add(
|
||||
'Expected the $i element in "${kvp.key}" to be a map, but got ${yamlList[i]} (${yamlList[i].runtimeType}).',
|
||||
);
|
||||
|
||||
@@ -1799,7 +1799,6 @@ class TerminalHandler {
|
||||
await _commonTerminalInputHandler(command);
|
||||
// Catch all exception since this is doing cleanup and rethrowing.
|
||||
} catch (error, st) {
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
// Don't print stack traces for known error types.
|
||||
if (error is! ToolExit) {
|
||||
_logger.printError('$error\n$st');
|
||||
|
||||
@@ -258,7 +258,6 @@ class HotRunner extends ResidentRunner {
|
||||
);
|
||||
// Catches all exceptions, non-Exception objects are rethrown.
|
||||
} catch (error) {
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
if (error is! Exception && error is! String) {
|
||||
rethrow;
|
||||
}
|
||||
|
||||
@@ -991,7 +991,6 @@ class BrowserManager {
|
||||
return await controller.suite;
|
||||
// Not limiting to catching Exception because the exception is rethrown.
|
||||
} catch (_) {
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
closeIframe();
|
||||
rethrow;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,6 @@ class Tracing {
|
||||
}
|
||||
// The exception is rethrown, so don't catch only Exceptions.
|
||||
} catch (exception) {
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
status.cancel();
|
||||
rethrow;
|
||||
}
|
||||
|
||||
@@ -1237,7 +1237,6 @@ void main() {
|
||||
try {
|
||||
await createTestCommandRunner(command).run(<String>['run', '--no-pub']);
|
||||
} catch (err) {
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
fail('Expected no error, got $err');
|
||||
}
|
||||
expect(fakeTerminal.setSingleCharModeHistory, isEmpty);
|
||||
|
||||
@@ -1168,7 +1168,6 @@ void main() {
|
||||
expect(schemeFile.existsSync(), isTrue);
|
||||
expect(schemeFile.readAsStringSync(), contains('FilePath = "/path/to/bundle"'));
|
||||
} catch (err) {
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
fail(err.toString());
|
||||
} finally {
|
||||
projectDirectory.deleteSync(recursive: true);
|
||||
|
||||
@@ -291,7 +291,6 @@ OS 版本: 10.0.22621 暂缺 Build 22621
|
||||
try {
|
||||
final ProcessResult result = await processLister.getProcessesWithPath();
|
||||
expect(result.stdout, ProcessLister.powershell);
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
} catch (e) {
|
||||
fail('Unexpected exception: $e');
|
||||
}
|
||||
@@ -312,7 +311,6 @@ OS 版本: 10.0.22621 暂缺 Build 22621
|
||||
try {
|
||||
final ProcessResult result = await processLister.getProcessesWithPath();
|
||||
expect(result.stdout, ProcessLister.pwsh);
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
} catch (e) {
|
||||
fail('Unexpected exception: $e');
|
||||
}
|
||||
@@ -332,7 +330,6 @@ OS 版本: 10.0.22621 暂缺 Build 22621
|
||||
fail('Should have thrown, but successfully ran ${result.stdout}');
|
||||
} on StateError {
|
||||
// Expected
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
} catch (e) {
|
||||
fail('Unexpected exception: $e');
|
||||
}
|
||||
|
||||
@@ -150,7 +150,6 @@ Future<void> expectToolExitLater(Future<dynamic> future, Matcher messageMatcher)
|
||||
expect(e.message, messageMatcher);
|
||||
// Catch all exceptions to give a better test failure message.
|
||||
} catch (e, trace) {
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
fail('ToolExit expected, got $e\n$trace');
|
||||
}
|
||||
}
|
||||
@@ -160,7 +159,6 @@ Future<void> expectReturnsNormallyLater(Future<dynamic> future) async {
|
||||
await future;
|
||||
// Catch all exceptions to give a better test failure message.
|
||||
} catch (e, trace) {
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
fail('Expected to run with no exceptions, got $e\n$trace');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,6 @@ class MemoryIOSink implements IOSink {
|
||||
add(data);
|
||||
// Catches all exceptions to propagate them to the completer.
|
||||
} catch (err, stack) {
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
sub.cancel();
|
||||
completer.completeError(err, stack);
|
||||
}
|
||||
@@ -201,10 +200,8 @@ class MemoryStdout extends MemoryIOSink implements io.Stdout {
|
||||
bool _hasTerminal = true;
|
||||
|
||||
@override
|
||||
// ignore: override_on_non_overriding_member
|
||||
String get lineTerminator => '\n';
|
||||
@override
|
||||
// ignore: override_on_non_overriding_member
|
||||
set lineTerminator(String value) {
|
||||
throw UnimplementedError('Setting the line terminator is not supported');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user