Commit 6d2d4953 authored by Phil Quitslund's avatar Phil Quitslund

Merge pull request #4348 from pq/fix_4091

Fix flutter analyze defaults when files are specified (#4091).
parents d9916bbb ce82bc1b
......@@ -102,9 +102,13 @@ class AnalyzeCommand extends FlutterCommand {
}
}
bool currentDirectory = argResults['current-directory'] && (argResults.wasParsed('current-directory') || dartFiles.isEmpty);
bool currentPackage = argResults['current-package'] && (argResults.wasParsed('current-package') || dartFiles.isEmpty);
bool flutterRepo = argResults['flutter-repo'];
//TODO (pq): revisit package and directory defaults
if (argResults['current-directory'] && !argResults['flutter-repo']) {
if (currentDirectory && !flutterRepo) {
// ./*.dart
Directory currentDirectory = new Directory('.');
bool foundOne = false;
......@@ -118,7 +122,7 @@ class AnalyzeCommand extends FlutterCommand {
pubSpecDirectories.add(currentDirectory);
}
if (argResults['current-package'] && !argResults['flutter-repo']) {
if (currentPackage && !flutterRepo) {
// **/.*dart
Directory currentDirectory = new Directory('.');
_collectDartFiles(currentDirectory, dartFiles);
......@@ -129,7 +133,7 @@ class AnalyzeCommand extends FlutterCommand {
//TODO (pq): extract this regexp from the exclude in options
RegExp stockExampleFiles = new RegExp('examples/stocks/lib/.*\.dart\$');
if (argResults['flutter-repo']) {
if (flutterRepo) {
for (Directory dir in runner.getRepoPackages()) {
_collectDartFiles(dir, dartFiles,
exclude: (FileSystemEntity entity) => stockExampleFiles.hasMatch(entity.path));
......
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