enable no_literal_bool_comparisons lint (#126647)

This commit is contained in:
Michael Goderbauer
2023-05-16 18:14:23 +02:00
committed by GitHub
parent b45f9b36e8
commit 5e1ba701ed
46 changed files with 79 additions and 79 deletions

View File

@@ -103,7 +103,7 @@ void main() {
);
int errorCount = 0;
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => analyzing == false).first;
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => !analyzing).first;
server.onErrors.listen((FileAnalysisErrors errors) => errorCount += errors.errors.length);
await server.start();
@@ -144,7 +144,7 @@ void main() {
);
int errorCount = 0;
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => analyzing == false).first;
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => !analyzing).first;
server.onErrors.listen((FileAnalysisErrors errors) {
errorCount += errors.errors.length;
});
@@ -172,7 +172,7 @@ void main() {
);
int errorCount = 0;
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => analyzing == false).first;
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => !analyzing).first;
server.onErrors.listen((FileAnalysisErrors errors) {
errorCount += errors.errors.length;
});

View File

@@ -224,7 +224,7 @@ void main() {
FlutterProject setupProjectUnderTest(Directory currentDirectory, bool setupXcodeWorkspace) {
// This needs to be run within testWithoutContext and not setUp since FlutterProject uses context.
final FlutterProject projectUnderTest = FlutterProject.fromDirectory(currentDirectory);
if (setupXcodeWorkspace == true) {
if (setupXcodeWorkspace) {
projectUnderTest.ios.hostAppRoot.childDirectory('Runner.xcworkspace').createSync(recursive: true);
projectUnderTest.macos.hostAppRoot.childDirectory('Runner.xcworkspace').createSync(recursive: true);
}

View File

@@ -39,7 +39,7 @@ class FakePub extends Fake implements Pub {
PubOutputMode outputMode = PubOutputMode.all,
}) async {
project.directory.childFile('.packages').createSync();
if (offline == true) {
if (offline) {
calledGetOffline += 1;
} else {
calledOnline += 1;

View File

@@ -1278,10 +1278,10 @@ class FakeDevice extends Fake implements Device {
bool ipv6 = false,
String? userIdentifier,
}) async {
if (startAppSuccess == false) {
if (!startAppSuccess) {
return LaunchResult.failed();
}
if (startAppSuccess == true) {
if (startAppSuccess) {
return LaunchResult.succeeded();
}
final String dartFlags = debuggingOptions.dartFlags;

View File

@@ -124,7 +124,7 @@ void verifyCommand(Command<Object?> runner) {
final String firstDescriptionLine = runner.description.split('\n').first;
expect(firstDescriptionLine, matches(_allowedTrailingPatterns), reason: "command ${runner.name}'s description does not end with the expected single period that a full sentence should end with");
if (runner.hidden == false && runner.parent == null) {
if (!runner.hidden && runner.parent == null) {
expect(
runner.category,
anyOf(

View File

@@ -163,7 +163,7 @@ void main() {
final Iterable<String> rows = testLogger.statusText
.split('\n')
.map((String line) => line.trim())
.where((String line) => line.isNotEmpty == true)
.where((String line) => line.isNotEmpty)
.skip(1); // remove `Flutter channels:` line
expect(rows, <String>['beta', 'stable', 'Currently not on an official channel.']);
@@ -194,7 +194,7 @@ void main() {
final Iterable<String> rows = testLogger.statusText
.split('\n')
.map((String line) => line.trim())
.where((String line) => line.isNotEmpty == true)
.where((String line) => line.isNotEmpty)
.skip(1); // remove `Flutter channels:` line
expect(rows, <String>['beta', 'stable', 'Currently not on an official channel.']);