apply lint prefer_void_to_null in dev/ (#22661)
This commit is contained in:
committed by
GitHub
parent
89c5ace117
commit
d340e2f229
@@ -99,7 +99,7 @@ class Section {
|
||||
const String kDartDocPrefix = '///';
|
||||
const String kDartDocPrefixWithSpace = '$kDartDocPrefix ';
|
||||
|
||||
Future<Null> main(List<String> arguments) async {
|
||||
Future<void> main(List<String> arguments) async {
|
||||
final Directory tempDir = Directory.systemTemp.createTempSync('flutter_analyze_sample_code.');
|
||||
int exitCode = 1;
|
||||
bool keepMain = false;
|
||||
|
||||
@@ -11,8 +11,6 @@ import 'package:meta/meta.dart';
|
||||
|
||||
import 'run_command.dart';
|
||||
|
||||
typedef ShardRunner = Future<Null> Function();
|
||||
|
||||
final String flutterRoot = path.dirname(path.dirname(path.dirname(path.fromUri(Platform.script))));
|
||||
final String flutter = path.join(flutterRoot, 'bin', Platform.isWindows ? 'flutter.bat' : 'flutter');
|
||||
final String dart = path.join(flutterRoot, 'bin', 'cache', 'dart-sdk', 'bin', Platform.isWindows ? 'dart.exe' : 'dart');
|
||||
@@ -25,7 +23,7 @@ final String pubCache = path.join(flutterRoot, '.pub-cache');
|
||||
///
|
||||
/// For example:
|
||||
/// bin/cache/dart-sdk/bin/dart dev/bots/analyze.dart --dart-sdk=/tmp/dart-sdk
|
||||
Future<Null> main(List<String> args) async {
|
||||
Future<void> main(List<String> args) async {
|
||||
await _verifyNoTestPackageImports(flutterRoot);
|
||||
await _verifyGeneratedPluginRegistrants(flutterRoot);
|
||||
await _verifyNoBadImportsInFlutter(flutterRoot);
|
||||
@@ -84,7 +82,7 @@ Future<Null> main(List<String> args) async {
|
||||
print('${bold}DONE: Analysis successful.$reset');
|
||||
}
|
||||
|
||||
Future<Null> _verifyInternationalizations() async {
|
||||
Future<void> _verifyInternationalizations() async {
|
||||
final EvalResult genResult = await _evalCommand(
|
||||
dart,
|
||||
<String>[
|
||||
@@ -134,7 +132,7 @@ Future<String> _getCommitRange() async {
|
||||
}
|
||||
|
||||
|
||||
Future<Null> _checkForTrailingSpaces() async {
|
||||
Future<void> _checkForTrailingSpaces() async {
|
||||
if (!Platform.isWindows) {
|
||||
final String commitRange = Platform.environment.containsKey('TEST_COMMIT_RANGE')
|
||||
? Platform.environment['TEST_COMMIT_RANGE']
|
||||
@@ -229,7 +227,7 @@ Future<EvalResult> _evalCommand(String executable, List<String> arguments, {
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<Null> _runFlutterAnalyze(String workingDirectory, {
|
||||
Future<void> _runFlutterAnalyze(String workingDirectory, {
|
||||
List<String> options = const <String>[]
|
||||
}) {
|
||||
return runCommand(flutter, <String>['analyze']..addAll(options),
|
||||
@@ -237,7 +235,7 @@ Future<Null> _runFlutterAnalyze(String workingDirectory, {
|
||||
);
|
||||
}
|
||||
|
||||
Future<Null> _verifyNoTestPackageImports(String workingDirectory) async {
|
||||
Future<void> _verifyNoTestPackageImports(String workingDirectory) async {
|
||||
// TODO(ianh): Remove this whole test once https://github.com/dart-lang/matcher/issues/98 is fixed.
|
||||
final List<String> shims = <String>[];
|
||||
final List<String> errors = Directory(workingDirectory)
|
||||
@@ -315,7 +313,7 @@ Future<Null> _verifyNoTestPackageImports(String workingDirectory) async {
|
||||
}
|
||||
}
|
||||
|
||||
Future<Null> _verifyNoBadImportsInFlutter(String workingDirectory) async {
|
||||
Future<void> _verifyNoBadImportsInFlutter(String workingDirectory) async {
|
||||
final List<String> errors = <String>[];
|
||||
final String libPath = path.join(workingDirectory, 'packages', 'flutter', 'lib');
|
||||
final String srcPath = path.join(workingDirectory, 'packages', 'flutter', 'lib', 'src');
|
||||
@@ -439,7 +437,7 @@ List<T> _deepSearch<T>(Map<T, Set<T>> map, T start, [ Set<T> seen ]) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<Null> _verifyNoBadImportsInFlutterTools(String workingDirectory) async {
|
||||
Future<void> _verifyNoBadImportsInFlutterTools(String workingDirectory) async {
|
||||
final List<String> errors = <String>[];
|
||||
for (FileSystemEntity entity in Directory(path.join(workingDirectory, 'packages', 'flutter_tools', 'lib'))
|
||||
.listSync(recursive: true)
|
||||
@@ -463,7 +461,7 @@ Future<Null> _verifyNoBadImportsInFlutterTools(String workingDirectory) async {
|
||||
}
|
||||
}
|
||||
|
||||
Future<Null> _verifyGeneratedPluginRegistrants(String flutterRoot) async {
|
||||
Future<void> _verifyGeneratedPluginRegistrants(String flutterRoot) async {
|
||||
final Directory flutterRootDir = Directory(flutterRoot);
|
||||
|
||||
final Map<String, List<File>> packageToRegistrants = <String, List<File>>{};
|
||||
|
||||
@@ -119,8 +119,8 @@ class ProcessRunner {
|
||||
stderr.write('Running "${commandLine.join(' ')}" in ${workingDirectory.path}.\n');
|
||||
}
|
||||
final List<int> output = <int>[];
|
||||
final Completer<Null> stdoutComplete = Completer<Null>();
|
||||
final Completer<Null> stderrComplete = Completer<Null>();
|
||||
final Completer<void> stdoutComplete = Completer<void>();
|
||||
final Completer<void> stderrComplete = Completer<void>();
|
||||
Process process;
|
||||
Future<int> allComplete() async {
|
||||
await stderrComplete.future;
|
||||
@@ -291,7 +291,7 @@ class ArchiveCreator {
|
||||
|
||||
/// Clone the Flutter repo and make sure that the git environment is sane
|
||||
/// for when the user will unpack it.
|
||||
Future<Null> _checkoutFlutter() async {
|
||||
Future<void> _checkoutFlutter() async {
|
||||
// We want the user to start out the in the specified branch instead of a
|
||||
// detached head. To do that, we need to make sure the branch points at the
|
||||
// desired revision.
|
||||
@@ -303,7 +303,7 @@ class ArchiveCreator {
|
||||
}
|
||||
|
||||
/// Retrieve the MinGit executable from storage and unpack it.
|
||||
Future<Null> _installMinGitIfNeeded() async {
|
||||
Future<void> _installMinGitIfNeeded() async {
|
||||
if (!platform.isWindows) {
|
||||
return;
|
||||
}
|
||||
@@ -319,7 +319,7 @@ class ArchiveCreator {
|
||||
|
||||
/// Prepare the archive repo so that it has all of the caches warmed up and
|
||||
/// is configured for the user to begin working.
|
||||
Future<Null> _populateCaches() async {
|
||||
Future<void> _populateCaches() async {
|
||||
await _runFlutter(<String>['doctor']);
|
||||
await _runFlutter(<String>['update-packages']);
|
||||
await _runFlutter(<String>['precache']);
|
||||
@@ -342,7 +342,7 @@ class ArchiveCreator {
|
||||
}
|
||||
|
||||
/// Write the archive to the given output file.
|
||||
Future<Null> _archiveFiles(File outputFile) async {
|
||||
Future<void> _archiveFiles(File outputFile) async {
|
||||
if (outputFile.path.toLowerCase().endsWith('.zip')) {
|
||||
await _createZipArchive(outputFile, flutterRoot);
|
||||
} else if (outputFile.path.toLowerCase().endsWith('.tar.xz')) {
|
||||
@@ -454,7 +454,7 @@ class ArchivePublisher {
|
||||
static String getMetadataFilename(Platform platform) => 'releases_${platform.operatingSystem.toLowerCase()}.json';
|
||||
|
||||
/// Publish the archive to Google Storage.
|
||||
Future<Null> publishArchive() async {
|
||||
Future<void> publishArchive() async {
|
||||
final String destGsPath = '$gsReleaseFolder/$destinationArchivePath';
|
||||
await _cloudCopy(outputFile.absolute.path, destGsPath);
|
||||
assert(tempDir.existsSync());
|
||||
@@ -497,7 +497,7 @@ class ArchivePublisher {
|
||||
return jsonData;
|
||||
}
|
||||
|
||||
Future<Null> _updateMetadata() async {
|
||||
Future<void> _updateMetadata() async {
|
||||
// We can't just cat the metadata from the server with 'gsutil cat', because
|
||||
// Windows wants to echo the commands that execute in gsutil.bat to the
|
||||
// stdout when we do that. So, we copy the file locally and then read it
|
||||
@@ -569,7 +569,7 @@ class ArchivePublisher {
|
||||
///
|
||||
/// Archives contain the executables and customizations for the platform that
|
||||
/// they are created on.
|
||||
Future<Null> main(List<String> argList) async {
|
||||
Future<void> main(List<String> argList) async {
|
||||
final ArgParser argParser = ArgParser();
|
||||
argParser.addOption(
|
||||
'temp_dir',
|
||||
|
||||
@@ -30,7 +30,7 @@ void printProgress(String action, String workingDir, String command) {
|
||||
print('$arrow $action: cd $cyan$workingDir$reset; $yellow$command$reset');
|
||||
}
|
||||
|
||||
Future<Null> runCommand(String executable, List<String> arguments, {
|
||||
Future<void> runCommand(String executable, List<String> arguments, {
|
||||
String workingDirectory,
|
||||
Map<String, String> environment,
|
||||
bool expectNonZeroExit = false,
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'package:path/path.dart' as path;
|
||||
|
||||
import 'run_command.dart';
|
||||
|
||||
typedef ShardRunner = Future<Null> Function();
|
||||
typedef ShardRunner = Future<void> Function();
|
||||
|
||||
final String flutterRoot = path.dirname(path.dirname(path.dirname(path.fromUri(Platform.script))));
|
||||
final String flutter = path.join(flutterRoot, 'bin', Platform.isWindows ? 'flutter.bat' : 'flutter');
|
||||
@@ -37,7 +37,7 @@ const Duration _kShortTimeout = Duration(minutes: 5);
|
||||
/// For example:
|
||||
/// SHARD=tool_tests bin/cache/dart-sdk/bin/dart dev/bots/test.dart
|
||||
/// bin/cache/dart-sdk/bin/dart dev/bots/test.dart --local-engine=host_debug_unopt
|
||||
Future<Null> main(List<String> args) async {
|
||||
Future<void> main(List<String> args) async {
|
||||
flutterTestArgs.addAll(args);
|
||||
|
||||
final String shard = Platform.environment['SHARD'];
|
||||
@@ -58,7 +58,7 @@ Future<Null> main(List<String> args) async {
|
||||
}
|
||||
}
|
||||
|
||||
Future<Null> _runSmokeTests() async {
|
||||
Future<void> _runSmokeTests() async {
|
||||
// Verify that the tests actually return failure on failure and success on
|
||||
// success.
|
||||
final String automatedTests = path.join(flutterRoot, 'dev', 'automated_tests');
|
||||
@@ -138,7 +138,7 @@ Future<Null> _runSmokeTests() async {
|
||||
await _verifyVersion(path.join(flutterRoot, 'version'));
|
||||
}
|
||||
|
||||
Future<Null> _runToolTests() async {
|
||||
Future<void> _runToolTests() async {
|
||||
await _runSmokeTests();
|
||||
|
||||
await _pubRunTest(
|
||||
@@ -149,7 +149,7 @@ Future<Null> _runToolTests() async {
|
||||
print('${bold}DONE: All tests successful.$reset');
|
||||
}
|
||||
|
||||
Future<Null> _runTests() async {
|
||||
Future<void> _runTests() async {
|
||||
await _runSmokeTests();
|
||||
|
||||
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter'));
|
||||
@@ -171,7 +171,7 @@ Future<Null> _runTests() async {
|
||||
print('${bold}DONE: All tests successful.$reset');
|
||||
}
|
||||
|
||||
Future<Null> _runCoverage() async {
|
||||
Future<void> _runCoverage() async {
|
||||
final File coverageFile = File(path.join(flutterRoot, 'packages', 'flutter', 'coverage', 'lcov.info'));
|
||||
if (!coverageFile.existsSync()) {
|
||||
print('${red}Coverage file not found.$reset');
|
||||
@@ -193,7 +193,7 @@ Future<Null> _runCoverage() async {
|
||||
print('${bold}DONE: Coverage collection successful.$reset');
|
||||
}
|
||||
|
||||
Future<Null> _pubRunTest(
|
||||
Future<void> _pubRunTest(
|
||||
String workingDirectory, {
|
||||
String testPath,
|
||||
bool enableFlutterToolAsserts = false
|
||||
@@ -234,7 +234,7 @@ class EvalResult {
|
||||
final int exitCode;
|
||||
}
|
||||
|
||||
Future<Null> _runFlutterTest(String workingDirectory, {
|
||||
Future<void> _runFlutterTest(String workingDirectory, {
|
||||
String script,
|
||||
bool expectFailure = false,
|
||||
bool printOutput = true,
|
||||
@@ -268,7 +268,7 @@ Future<Null> _runFlutterTest(String workingDirectory, {
|
||||
);
|
||||
}
|
||||
|
||||
Future<Null> _verifyVersion(String filename) async {
|
||||
Future<void> _verifyVersion(String filename) async {
|
||||
if (!File(filename).existsSync()) {
|
||||
print('$redLine');
|
||||
print('The version logic failed to create the Flutter version file.');
|
||||
|
||||
Reference in New Issue
Block a user