Commit eb215c14 authored by pq's avatar pq

Review cleanup.

parent 4311ddb4
...@@ -7,7 +7,9 @@ dependencies: ...@@ -7,7 +7,9 @@ dependencies:
# here we pin it precisely to avoid version skew across our packages. # here we pin it precisely to avoid version skew across our packages.
test: 0.12.13+1 test: 0.12.13+1
# Pinned in flutter_tools as well. # We don't actually depend on 'analyzer', but 'test' and 'flutter_tools' do.
# We pin the version of analyzer we depend on to avoid version skew across our
# packages.
analyzer: 0.27.4-alpha.1 analyzer: 0.27.4-alpha.1
flutter: flutter:
......
...@@ -111,32 +111,31 @@ class AnalyzeCommand extends FlutterCommand { ...@@ -111,32 +111,31 @@ class AnalyzeCommand extends FlutterCommand {
} }
} }
//TODO(pq): revisit package and directory defaults //TODO (pq): revisit package and directory defaults
if (argResults['current-directory'] && !argResults['flutter-repo']) { if (argResults['current-directory'] && !argResults['flutter-repo']) {
// ./*.dart // ./*.dart
Directory cwd = new Directory('.'); Directory currentDirectory = new Directory('.');
bool foundOne = false; bool foundOne = false;
for (FileSystemEntity entry in cwd.listSync()) { for (FileSystemEntity entry in currentDirectory.listSync()) {
if (isDartFile(entry)) { if (isDartFile(entry)) {
dartFiles.add(entry); dartFiles.add(entry);
foundOne = true; foundOne = true;
} }
} }
if (foundOne) { if (foundOne)
pubSpecDirectories.add(cwd); pubSpecDirectories.add(currentDirectory);
}
} }
if (argResults['current-package'] && !argResults['flutter-repo']) { if (argResults['current-package'] && !argResults['flutter-repo']) {
// **/.*dart // **/.*dart
Directory cwd = new Directory('.'); Directory currentDirectory = new Directory('.');
_collectDartFiles(cwd, dartFiles); _collectDartFiles(currentDirectory, dartFiles);
pubSpecDirectories.add(cwd); pubSpecDirectories.add(currentDirectory);
} }
//TODO(ianh): Fix the intl package resource generator //TODO (ianh): Fix the intl package resource generator
//TODO(pq): extract this regexp from the exclude in options //TODO (pq): extract this regexp from the exclude in options
RegExp stockExampleFiles = new RegExp('examples/stocks/lib/.*\.dart\$'); RegExp stockExampleFiles = new RegExp('examples/stocks/lib/.*\.dart\$');
if (argResults['flutter-repo']) { if (argResults['flutter-repo']) {
...@@ -200,7 +199,7 @@ class AnalyzeCommand extends FlutterCommand { ...@@ -200,7 +199,7 @@ class AnalyzeCommand extends FlutterCommand {
packagesBody.writeln('$package:${path.toUri(packages[package])}'); packagesBody.writeln('$package:${path.toUri(packages[package])}');
// save the .packages file to disk // save the .packages file to disk
//TODO(pq): consider passing package info via a data URI //TODO (pq): consider passing package info via a data URI
Directory host = Directory.systemTemp.createTempSync('flutter-analyze-'); Directory host = Directory.systemTemp.createTempSync('flutter-analyze-');
String packagesFilePath = path.join(host.path, '.packages'); String packagesFilePath = path.join(host.path, '.packages');
new File(packagesFilePath).writeAsStringSync(packagesBody.toString()); new File(packagesFilePath).writeAsStringSync(packagesBody.toString());
...@@ -218,7 +217,7 @@ class AnalyzeCommand extends FlutterCommand { ...@@ -218,7 +217,7 @@ class AnalyzeCommand extends FlutterCommand {
options.analysisOptionsFile = path.join(ArtifactStore.flutterRoot, 'packages', 'flutter_tools', 'flutter_analysis_options'); options.analysisOptionsFile = path.join(ArtifactStore.flutterRoot, 'packages', 'flutter_tools', 'flutter_analysis_options');
AnalysisDriver analyzer = new AnalysisDriver(options); AnalysisDriver analyzer = new AnalysisDriver(options);
//TODO:(pq): consider error handling //TODO (pq): consider error handling
List<AnalysisErrorDescription> errors = analyzer.analyze(dartFiles); List<AnalysisErrorDescription> errors = analyzer.analyze(dartFiles);
int errorCount = 0; int errorCount = 0;
...@@ -277,9 +276,8 @@ class AnalyzeCommand extends FlutterCommand { ...@@ -277,9 +276,8 @@ class AnalyzeCommand extends FlutterCommand {
return collected; return collected;
for (FileSystemEntity entity in dir.listSync(recursive: false, followLinks: false)) { for (FileSystemEntity entity in dir.listSync(recursive: false, followLinks: false)) {
if (isDartFile(entity) && (exclude == null || !exclude(entity))) { if (isDartFile(entity) && (exclude == null || !exclude(entity)))
collected.add(entity); collected.add(entity);
}
if (entity is Directory) { if (entity is Directory) {
String name = path.basename(entity.path); String name = path.basename(entity.path);
if (!name.startsWith('.') && name != 'packages') if (!name.startsWith('.') && name != 'packages')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment