Enable always_declare_return_types lint

And fix a zillion omissions this uncovered.
This commit is contained in:
Hixie
2016-03-09 17:43:14 -08:00
parent bdc8388699
commit c7339de6bc
50 changed files with 99 additions and 142 deletions

View File

@@ -4,4 +4,6 @@
import 'package:flutter_tools/executable.dart' as executable;
main(List<String> args) => executable.main(args);
void main(List<String> args) {
executable.main(args);
}

View File

@@ -204,7 +204,7 @@ class AdbDevice {
/// Device model; can be null. `XT1045`, `Nexus_7`
String get modelID => _info['model'];
set modelID(String value) {
void set modelID(String value) {
_info['model'] = value;
}

View File

@@ -288,6 +288,7 @@ analyzer:
todo: ignore
linter:
rules:
- always_declare_return_types
# we'll turn on avoid_as as soon as it doesn't complain about "as dynamic"
# - avoid_as
- camel_case_types

View File

@@ -5,9 +5,7 @@
import 'package:flutter_tools/src/android/adb.dart';
import 'package:test/test.dart';
main() => defineTests();
defineTests() {
void main() {
Adb adb = new Adb('adb');
// We only test the [Adb] class is we're able to locate the adb binary.

View File

@@ -14,9 +14,7 @@ import 'package:test/test.dart';
import 'src/context.dart';
main() => defineTests();
defineTests() {
void main() {
AnalysisServer server;
Directory tempDir;

View File

@@ -7,9 +7,7 @@ import 'package:test/test.dart';
import 'src/context.dart';
main() => defineTests();
defineTests() {
void main() {
group('android_device', () {
testUsingContext('stores the requested id', () {
String deviceId = '1234';

View File

@@ -7,9 +7,7 @@ import 'dart:async';
import 'package:flutter_tools/src/base/utils.dart';
import 'package:test/test.dart';
main() => defineTests();
defineTests() {
void main() {
group('ItemListNotifier', () {
test('sends notifications', () async {
ItemListNotifier<String> list = new ItemListNotifier<String>();

View File

@@ -7,9 +7,7 @@ import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/globals.dart';
import 'package:test/test.dart';
main() => defineTests();
defineTests() {
void main() {
group('DeviceManager', () {
test('error', () async {
AppContext context = new AppContext();

View File

@@ -13,9 +13,7 @@ import 'package:test/test.dart';
import 'src/context.dart';
main() => defineTests();
defineTests() {
void main() {
group('create', () {
Directory temp;

View File

@@ -17,9 +17,7 @@ import 'package:test/test.dart';
import 'src/context.dart';
import 'src/mocks.dart';
main() => defineTests();
defineTests() {
void main() {
Daemon daemon;
AppContext appContext;
NotifyingLogger notifyingLogger;

View File

@@ -7,9 +7,7 @@ import 'package:test/test.dart';
import 'src/context.dart';
main() => defineTests();
defineTests() {
void main() {
group('DeviceManager', () {
testUsingContext('getDevices', () async {
// Test that DeviceManager.getDevices() doesn't throw.

View File

@@ -10,9 +10,7 @@ import 'package:test/test.dart';
import 'src/common.dart';
import 'src/context.dart';
main() => defineTests();
defineTests() {
void main() {
group('devices', () {
testUsingContext('returns 0 when called', () {
DevicesCommand command = new DevicesCommand();

View File

@@ -20,9 +20,7 @@ import 'src/common.dart';
import 'src/context.dart';
import 'src/mocks.dart';
main() => defineTests();
defineTests() {
void main() {
group('drive', () {
DriveCommand command;
Device mockDevice;
@@ -182,7 +180,7 @@ defineTests() {
});
group('findTargetDevice on iOS', () {
setOs() {
void setOs() {
when(os.isMacOS).thenReturn(true);
when(os.isLinux).thenReturn(false);
}
@@ -222,7 +220,7 @@ defineTests() {
});
group('findTargetDevice on Linux', () {
setOs() {
void setOs() {
when(os.isMacOS).thenReturn(false);
when(os.isLinux).thenReturn(true);
}

View File

@@ -10,9 +10,7 @@ import 'src/common.dart';
import 'src/context.dart';
import 'src/mocks.dart';
main() => defineTests();
defineTests() {
void main() {
group('install', () {
testUsingContext('returns 0 when Android is connected and ready for an install', () {
InstallCommand command = new InstallCommand();

View File

@@ -9,9 +9,7 @@ import 'src/common.dart';
import 'src/context.dart';
import 'src/mocks.dart';
main() => defineTests();
defineTests() {
void main() {
group('listen', () {
testUsingContext('returns 1 when no device is connected', () {
ListenCommand command = new ListenCommand(singleRun: true);

View File

@@ -9,9 +9,7 @@ import 'src/common.dart';
import 'src/context.dart';
import 'src/mocks.dart';
main() => defineTests();
defineTests() {
void main() {
group('logs', () {
testUsingContext('fail with a bad device id', () {
LogsCommand command = new LogsCommand();

View File

@@ -8,9 +8,7 @@ import 'package:flutter_tools/src/base/os.dart';
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
main() => defineTests();
defineTests() {
void main() {
group('OperatingSystemUtils', () {
Directory temp;

View File

@@ -9,9 +9,7 @@ import 'src/common.dart';
import 'src/context.dart';
import 'src/mocks.dart';
main() => defineTests();
defineTests() {
void main() {
group('run', () {
testUsingContext('fails when target not found', () {
RunCommand command = new RunCommand();

View File

@@ -9,9 +9,7 @@ import 'package:flutter_tools/src/service_protocol.dart';
import 'src/mocks.dart';
main() => defineTests();
defineTests() {
void main() {
group('service_protocol', () {
test('Discovery Heartbeat', () async {
MockDeviceLogReader logReader = new MockDeviceLogReader();

View File

@@ -12,9 +12,7 @@ import 'src/common.dart';
import 'src/context.dart';
import 'src/mocks.dart';
main() => defineTests();
defineTests() {
void main() {
group('stop', () {
testUsingContext('returns 0 when Android is connected and ready to be stopped', () {
StopCommand command = new StopCommand();

View File

@@ -9,9 +9,7 @@ import 'src/common.dart';
import 'src/context.dart';
import 'src/mocks.dart';
main() => defineTests();
defineTests() {
void main() {
group('trace', () {
testUsingContext('returns 1 when no Android device is connected', () {
TraceCommand command = new TraceCommand();