Merge pull request #4348 from pq/fix_4091
Fix flutter analyze defaults when files are specified (#4091).
This commit is contained in:
commit
6d2d495369
@ -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
|
//TODO (pq): revisit package and directory defaults
|
||||||
|
|
||||||
if (argResults['current-directory'] && !argResults['flutter-repo']) {
|
if (currentDirectory && !flutterRepo) {
|
||||||
// ./*.dart
|
// ./*.dart
|
||||||
Directory currentDirectory = new Directory('.');
|
Directory currentDirectory = new Directory('.');
|
||||||
bool foundOne = false;
|
bool foundOne = false;
|
||||||
@ -118,7 +122,7 @@ class AnalyzeCommand extends FlutterCommand {
|
|||||||
pubSpecDirectories.add(currentDirectory);
|
pubSpecDirectories.add(currentDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argResults['current-package'] && !argResults['flutter-repo']) {
|
if (currentPackage && !flutterRepo) {
|
||||||
// **/.*dart
|
// **/.*dart
|
||||||
Directory currentDirectory = new Directory('.');
|
Directory currentDirectory = new Directory('.');
|
||||||
_collectDartFiles(currentDirectory, dartFiles);
|
_collectDartFiles(currentDirectory, dartFiles);
|
||||||
@ -129,7 +133,7 @@ class AnalyzeCommand extends FlutterCommand {
|
|||||||
//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 (flutterRepo) {
|
||||||
for (Directory dir in runner.getRepoPackages()) {
|
for (Directory dir in runner.getRepoPackages()) {
|
||||||
_collectDartFiles(dir, dartFiles,
|
_collectDartFiles(dir, dartFiles,
|
||||||
exclude: (FileSystemEntity entity) => stockExampleFiles.hasMatch(entity.path));
|
exclude: (FileSystemEntity entity) => stockExampleFiles.hasMatch(entity.path));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user