Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Remove unnecessary null checks in dev/bots (#118846)
Browse files Browse the repository at this point in the history
  • Loading branch information
goderbauer committed Jan 21, 2023
1 parent 70cecf6 commit c757df3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 18 deletions.
3 changes: 0 additions & 3 deletions dev/bots/analyze.dart
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,6 @@ Future<void> verifyDeprecations(String workingDirectory, { int minimumMatches =
}

String _generateLicense(String prefix) {
assert(prefix != null);
return '${prefix}Copyright 2014 The Flutter Authors. All rights reserved.\n'
'${prefix}Use of this source code is governed by a BSD-style license that can be\n'
'${prefix}found in the LICENSE file.';
Expand Down Expand Up @@ -1576,8 +1575,6 @@ Future<void> verifyNoBinaries(String workingDirectory, { Set<Hash256>? legacyBin
// UTILITY FUNCTIONS

bool _listEquals<T>(List<T> a, List<T> b) {
assert(a != null);
assert(b != null);
if (a.length != b.length) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion dev/bots/analyze_snippet_code.dart
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ class _SnippetChecker {
continue;
}

final _SnippetFile snippet = snippets[file.path]!;
final _SnippetFile? snippet = snippets[file.path];
if (snippet == null) {
errors.add(_SnippetCheckerException(
"Unknown section for ${file.path}. Maybe the temporary directory wasn't empty?",
Expand Down
4 changes: 1 addition & 3 deletions dev/bots/prepare_package.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ class PreparePackageException implements Exception {
@override
String toString() {
String output = runtimeType.toString();
if (message != null) {
output += ': $message';
}
output += ': $message';
final String stderr = result?.stderr as String? ?? '';
if (stderr.isNotEmpty) {
output += ':\n$stderr';
Expand Down
2 changes: 1 addition & 1 deletion dev/bots/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ Future<void> _runFrameworkTests() async {
printOutput: false,
outputChecker: (CommandResult result) {
final Iterable<Match> matches = httpClientWarning.allMatches(result.flattenedStdout!);
if (matches == null || matches.isEmpty || matches.length > 1) {
if (matches.isEmpty || matches.length > 1) {
return 'Failed to print warning about HttpClientUsage, or printed it too many times.\n\n'
'stdout:\n${result.flattenedStdout}\n\n'
'stderr:\n${result.flattenedStderr}';
Expand Down
13 changes: 3 additions & 10 deletions dev/bots/unpublish_package.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ class UnpublishException implements Exception {
@override
String toString() {
String output = runtimeType.toString();
if (message != null) {
output += ': $message';
}
output += ': $message';
final String stderr = result?.stderr as String? ?? '';
if (stderr.isNotEmpty) {
output += ':\n$stderr';
Expand Down Expand Up @@ -113,9 +111,7 @@ class ProcessRunner {
this.subprocessOutput = true,
this.defaultWorkingDirectory,
this.platform = const LocalPlatform(),
}) : assert(subprocessOutput != null),
assert(processManager != null),
assert(platform != null) {
}) {
environment = Map<String, String>.from(platform.environment);
}

Expand Down Expand Up @@ -255,9 +251,6 @@ class ArchiveUnpublisher {
continue;
}
final Map<String, String> replacementRelease = releases.firstWhere((Map<String, String> value) => value['channel'] == getChannelName(channel));
if (replacementRelease == null) {
throw UnpublishException('Unable to find previous release for channel ${getChannelName(channel)}.');
}
(jsonData['current_release'] as Map<String, dynamic>)[getChannelName(channel)] = replacementRelease['hash'];
print(
'${confirmed ? 'Reverting' : 'Would revert'} current ${getChannelName(channel)} '
Expand Down Expand Up @@ -468,7 +461,7 @@ Future<void> main(List<String> rawArguments) async {
final String tempDirArg = parsedArguments['temp_dir'] as String;
Directory tempDir;
bool removeTempDir = false;
if (tempDirArg == null || tempDirArg.isEmpty) {
if (tempDirArg.isEmpty) {
tempDir = Directory.systemTemp.createTempSync('flutter_package.');
removeTempDir = true;
} else {
Expand Down

0 comments on commit c757df3

Please sign in to comment.