Skip to content

Commit 6d2d495

Browse files
committed
Merge pull request #4348 from pq/fix_4091
Fix flutter analyze defaults when files are specified (#4091).
2 parents d9916bb + ce82bc1 commit 6d2d495

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎packages/flutter_tools/lib/src/commands/analyze.dart‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,13 @@ class AnalyzeCommand extends FlutterCommand {
102102
}
103103
}
104104

105+
bool currentDirectory = argResults['current-directory'] && (argResults.wasParsed('current-directory') || dartFiles.isEmpty);
106+
bool currentPackage = argResults['current-package'] && (argResults.wasParsed('current-package') || dartFiles.isEmpty);
107+
bool flutterRepo = argResults['flutter-repo'];
108+
105109
//TODO (pq): revisit package and directory defaults
106110

107-
if (argResults['current-directory'] && !argResults['flutter-repo']) {
111+
if (currentDirectory && !flutterRepo) {
108112
// ./*.dart
109113
Directory currentDirectory = new Directory('.');
110114
bool foundOne = false;
@@ -118,7 +122,7 @@ class AnalyzeCommand extends FlutterCommand {
118122
pubSpecDirectories.add(currentDirectory);
119123
}
120124

121-
if (argResults['current-package'] && !argResults['flutter-repo']) {
125+
if (currentPackage && !flutterRepo) {
122126
// **/.*dart
123127
Directory currentDirectory = new Directory('.');
124128
_collectDartFiles(currentDirectory, dartFiles);
@@ -129,7 +133,7 @@ class AnalyzeCommand extends FlutterCommand {
129133
//TODO (pq): extract this regexp from the exclude in options
130134
RegExp stockExampleFiles = new RegExp('examples/stocks/lib/.*\.dart\$');
131135

132-
if (argResults['flutter-repo']) {
136+
if (flutterRepo) {
133137
for (Directory dir in runner.getRepoPackages()) {
134138
_collectDartFiles(dir, dartFiles,
135139
exclude: (FileSystemEntity entity) => stockExampleFiles.hasMatch(entity.path));

0 commit comments

Comments
 (0)