Separate the 'if' expression from its statement (#9177)
This commit is contained in:
parent
0cf2f88f00
commit
189028a958
@ -128,7 +128,8 @@ final ArgParser _argParser = new ArgParser()
|
||||
);
|
||||
|
||||
bool _listsEqual(List<dynamic> a, List<dynamic> b) {
|
||||
if (a.length != b.length) return false;
|
||||
if (a.length != b.length)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
if (a[i] != b[i])
|
||||
|
@ -384,7 +384,8 @@ String get adbPath {
|
||||
|
||||
final String adbPath = path.join(androidHome, 'platform-tools/adb');
|
||||
|
||||
if (!canRun(adbPath)) throw 'adb not found at: $adbPath';
|
||||
if (!canRun(adbPath))
|
||||
throw 'adb not found at: $adbPath';
|
||||
|
||||
return path.absolute(adbPath);
|
||||
}
|
||||
|
@ -101,7 +101,8 @@ Future<VMIsolateRef> _connectToRunnerIsolate(int vmServicePort) async {
|
||||
final VM vm = await client.getVM();
|
||||
final VMIsolateRef isolate = vm.isolates.single;
|
||||
final String response = await isolate.invokeExtension('ext.cocoonRunnerReady');
|
||||
if (response != 'ready') throw 'not ready yet';
|
||||
if (response != 'ready')
|
||||
throw 'not ready yet';
|
||||
return isolate;
|
||||
} catch (error) {
|
||||
const Duration connectionTimeout = const Duration(seconds: 2);
|
||||
|
@ -306,7 +306,8 @@ Directory get flutterDirectory => dir('../..').absolute;
|
||||
String requireEnvVar(String name) {
|
||||
final String value = Platform.environment[name];
|
||||
|
||||
if (value == null) fail('$name environment variable is missing. Quitting.');
|
||||
if (value == null)
|
||||
fail('$name environment variable is missing. Quitting.');
|
||||
|
||||
return value;
|
||||
}
|
||||
@ -450,4 +451,4 @@ Future<int> findAvailablePort() async {
|
||||
}
|
||||
}
|
||||
|
||||
bool canRun(String path) => _processManager.canRun(path);
|
||||
bool canRun(String path) => _processManager.canRun(path);
|
||||
|
@ -112,7 +112,8 @@ class StartupTest {
|
||||
]).timeout(_startupTimeout);
|
||||
final Map<String, dynamic> data = JSON.decode(file('$testDirectory/build/start_up_info.json').readAsStringSync());
|
||||
|
||||
if (!reportMetrics) return new TaskResult.success(data);
|
||||
if (!reportMetrics)
|
||||
return new TaskResult.success(data);
|
||||
|
||||
return new TaskResult.success(data, benchmarkScoreKeys: <String>[
|
||||
'timeToFirstFrameMicros',
|
||||
|
@ -12,7 +12,8 @@ Future<String> mockUpdateUrlFetcher() {
|
||||
|
||||
void main() {
|
||||
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
|
||||
if (binding is LiveTestWidgetsFlutterBinding) binding.allowAllFrames = true;
|
||||
if (binding is LiveTestWidgetsFlutterBinding)
|
||||
binding.allowAllFrames = true;
|
||||
|
||||
// Regression test for https://github.com/flutter/flutter/pull/5168
|
||||
testWidgets('update dialog', (WidgetTester tester) async {
|
||||
|
@ -537,7 +537,8 @@ Future<VMServiceClientConnection> _waitAndConnect(String url) async {
|
||||
|
||||
Future<VMServiceClientConnection> attemptConnection() async {
|
||||
Uri uri = Uri.parse(url);
|
||||
if (uri.scheme == 'http') uri = uri.replace(scheme: 'ws', path: '/ws');
|
||||
if (uri.scheme == 'http')
|
||||
uri = uri.replace(scheme: 'ws', path: '/ws');
|
||||
|
||||
WebSocket ws1;
|
||||
WebSocket ws2;
|
||||
|
@ -190,7 +190,8 @@ class AndroidStudio implements Comparable<AndroidStudio> {
|
||||
|
||||
bool _hasStudioAt(String path, {Version newerThan}) {
|
||||
return studios.any((AndroidStudio studio) {
|
||||
if (studio.directory != path) return false;
|
||||
if (studio.directory != path)
|
||||
return false;
|
||||
if (newerThan != null) {
|
||||
return studio.version.compareTo(newerThan) >= 0;
|
||||
}
|
||||
|
@ -374,11 +374,13 @@ Map<_Asset, List<_Asset>> _parseAssets(
|
||||
if (manifestDescriptor.containsKey('fonts')) {
|
||||
for (Map<String, dynamic> family in manifestDescriptor['fonts']) {
|
||||
final List<Map<String, dynamic>> fonts = family['fonts'];
|
||||
if (fonts == null) continue;
|
||||
if (fonts == null)
|
||||
continue;
|
||||
|
||||
for (Map<String, dynamic> font in fonts) {
|
||||
final String asset = font['asset'];
|
||||
if (asset == null) continue;
|
||||
if (asset == null)
|
||||
continue;
|
||||
|
||||
final _Asset baseAsset = _resolveAsset(packageMap, assetBase, asset);
|
||||
if (!baseAsset.assetFileExists) {
|
||||
|
@ -207,7 +207,8 @@ String findProjectRoot([String directory]) {
|
||||
if (fs.isFileSync(fs.path.join(directory, kProjectRootSentinel)))
|
||||
return directory;
|
||||
final String parent = fs.path.dirname(directory);
|
||||
if (directory == parent) return null;
|
||||
if (directory == parent)
|
||||
return null;
|
||||
directory = parent;
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,10 @@ class Version implements Comparable<Version> {
|
||||
factory Version(int major, int minor, int patch, {String text}) {
|
||||
if (text == null) {
|
||||
text = major == null ? '0' : '$major';
|
||||
if (minor != null) text = '$text.$minor';
|
||||
if (patch != null) text = '$text.$patch';
|
||||
if (minor != null)
|
||||
text = '$text.$minor';
|
||||
if (patch != null)
|
||||
text = '$text.$patch';
|
||||
}
|
||||
|
||||
return new Version._(major ?? 0, minor ?? 0, patch ?? 0, text);
|
||||
@ -93,8 +95,10 @@ class Version implements Comparable<Version> {
|
||||
|
||||
@override
|
||||
int compareTo(Version other) {
|
||||
if (major != other.major) return major.compareTo(other.major);
|
||||
if (minor != other.minor) return minor.compareTo(other.minor);
|
||||
if (major != other.major)
|
||||
return major.compareTo(other.major);
|
||||
if (minor != other.minor)
|
||||
return minor.compareTo(other.minor);
|
||||
return patch.compareTo(other.patch);
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,13 @@ class ChannelCommand extends FlutterCommand {
|
||||
workingDirectory: Cache.flutterRoot,
|
||||
mapFunction: (String line) {
|
||||
final List<String> split = line.split('/');
|
||||
if (split.length < 2) return null;
|
||||
if (split.length < 2)
|
||||
return null;
|
||||
final String branchName = split[1];
|
||||
if (branchName.startsWith('HEAD')) return null;
|
||||
if (branchName == currentBranch) return '* $branchName';
|
||||
if (branchName.startsWith('HEAD'))
|
||||
return null;
|
||||
if (branchName == currentBranch)
|
||||
return '* $branchName';
|
||||
return ' $branchName';
|
||||
},
|
||||
);
|
||||
|
@ -369,7 +369,8 @@ class IntelliJValidatorOnLinuxAndWindows extends IntelliJValidator {
|
||||
|
||||
static Iterable<DoctorValidator> get installed {
|
||||
final List<DoctorValidator> validators = <DoctorValidator>[];
|
||||
if (homeDirPath == null) return validators;
|
||||
if (homeDirPath == null)
|
||||
return validators;
|
||||
|
||||
void addValidator(String title, String version, String installPath, String pluginsPath) {
|
||||
final IntelliJValidatorOnLinuxAndWindows validator =
|
||||
|
@ -115,7 +115,8 @@ void main() {
|
||||
final CreateCommand command = new CreateCommand();
|
||||
final CommandRunner<Null> runner = createTestCommandRunner(command);
|
||||
final File existingFile = fs.file("${temp.path.toString()}/bad");
|
||||
if (!existingFile.existsSync()) existingFile.createSync();
|
||||
if (!existingFile.existsSync())
|
||||
existingFile.createSync();
|
||||
try {
|
||||
await runner.run(<String>['create', existingFile.path]);
|
||||
fail('expected ToolExit exception');
|
||||
|
Loading…
x
Reference in New Issue
Block a user