Silence new analyzer warnings (#6866)

See https://github.com/flutter/flutter/pull/6861

This silences all but two of the warnings from https://travis-ci.org/flutter/flutter/builds/176055550

One of the silenced warnings was a genuine code error.

Some of the others were correct but there was no way for the analyzer to know, and I worked around them.

The remainder are problems with the analyzer, specifically https://github.com/dart-lang/sdk/issues/27827 and https://github.com/dart-lang/sdk/issues/27504.
This commit is contained in:
Ian Hickson
2016-11-15 12:35:50 -08:00
committed by GitHub
parent 9f1c91f934
commit 2b84d1ff1b
11 changed files with 40 additions and 36 deletions

View File

@@ -148,11 +148,12 @@ List<String> findPackageNames() {
List<Directory> findPackages() {
return new Directory('packages')
.listSync()
.where((FileSystemEntity entity) => entity is Directory)
.where((Directory dir) {
File pubspec = new File('${dir.path}/pubspec.yaml');
bool nodoc = pubspec.readAsStringSync().contains('nodoc: true');
return !nodoc;
.where((FileSystemEntity entity) {
if (entity is! Directory)
return false;
File pubspec = new File('${entity.path}/pubspec.yaml');
// TODO(ianh): Use a real YAML parser here
return !pubspec.readAsStringSync().contains('nodoc: true');
})
.toList();
}
@@ -160,7 +161,6 @@ List<Directory> findPackages() {
Iterable<String> libraryRefs() sync* {
for (Directory dir in findPackages()) {
String dirName = path.basename(dir.path);
for (FileSystemEntity file in new Directory('${dir.path}/lib').listSync()) {
if (file is File && file.path.endsWith('.dart'))
yield '$dirName/${path.basename(file.path)}';