diff --git a/.travis.yml b/.travis.yml index 04de0b4..e1f9e07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ dart: dart_task: - test - dartfmt - - dartanalyzer + - dartanalyzer: --fatal-infos --fatal-warnings . # Only building master means that we don't run two builds for each pull request. branches: diff --git a/example/example.dart b/example/example.dart index 4812a26..d0c47c1 100644 --- a/example/example.dart +++ b/example/example.dart @@ -26,7 +26,7 @@ main(List args) { var port = int.parse(results['port'] as String); var standalone = results['standalone'] as bool; - if (results.rest.length > 0) { + if (results.rest.isNotEmpty) { print('Got unexpected arguments: "${results.rest.join(' ')}".\n\nUsage:\n'); print(parser.usage); exit(1); diff --git a/example/src/examples/cow_repository.dart b/example/src/examples/cow_repository.dart index 4d86b5b..e061375 100644 --- a/example/src/examples/cow_repository.dart +++ b/example/src/examples/cow_repository.dart @@ -66,7 +66,7 @@ class CopyAndWriteRepository extends PackageRepository { .where((pv) => pv.versionString == version) .toList() .then((List versions) { - if (versions.length >= 1) return versions.first; + if (versions.isNotEmpty) return versions.first; return null; }); } diff --git a/example/src/examples/file_repository.dart b/example/src/examples/file_repository.dart index d35eeab..b61968b 100644 --- a/example/src/examples/file_repository.dart +++ b/example/src/examples/file_repository.dart @@ -49,7 +49,7 @@ class FileRepository extends PackageRepository { .where((pv) => pv.versionString == version) .toList() .then((List versions) { - if (versions.length >= 1) return versions.first; + if (versions.isNotEmpty) return versions.first; return null; }); } diff --git a/example/src/examples/http_proxy_repository.dart b/example/src/examples/http_proxy_repository.dart index 8ba1df8..735ed28 100644 --- a/example/src/examples/http_proxy_repository.dart +++ b/example/src/examples/http_proxy_repository.dart @@ -48,7 +48,7 @@ class HttpProxyRepository extends PackageRepository { .where((v) => v.packageName == package && v.versionString == version) .toList() .then((List versions) { - if (versions.length >= 1) return versions.first; + if (versions.isNotEmpty) return versions.first; return null; }); } diff --git a/lib/shelf_pubserver.dart b/lib/shelf_pubserver.dart index 12a3ef7..a11a9ae 100644 --- a/lib/shelf_pubserver.dart +++ b/lib/shelf_pubserver.dart @@ -240,7 +240,7 @@ class ShelfPubServer { } var packageVersions = await repository.versions(package).toList(); - if (packageVersions.length == 0) { + if (packageVersions.isEmpty) { return new shelf.Response.notFound(null); } @@ -416,7 +416,7 @@ class ShelfPubServer { Future _addUploader(String package, String body) async { var parts = body.split('='); - if (parts.length == 2 && parts[0] == 'email' && parts[1].length > 0) { + if (parts.length == 2 && parts[0] == 'email' && parts[1].isNotEmpty) { try { var user = Uri.decodeQueryComponent(parts[1]); await repository.addUploader(package, user);