Commit 108eb749 authored by Eric Seidel's avatar Eric Seidel

Merge pull request #1203 from eseidelGoogle/analyze_time

Teach analyze how to print out the total time spent
parents 3e5264a2 001c1078
...@@ -30,6 +30,7 @@ class AnalyzeCommand extends FlutterCommand { ...@@ -30,6 +30,7 @@ class AnalyzeCommand extends FlutterCommand {
@override @override
Future<int> runInProject() async { Future<int> runInProject() async {
Stopwatch stopwatch = new Stopwatch()..start();
Set<String> pubSpecDirectories = new Set<String>(); Set<String> pubSpecDirectories = new Set<String>();
List<String> dartFiles = argResults.rest.toList(); List<String> dartFiles = argResults.rest.toList();
...@@ -322,14 +323,16 @@ class AnalyzeCommand extends FlutterCommand { ...@@ -322,14 +323,16 @@ class AnalyzeCommand extends FlutterCommand {
errorCount += 1; errorCount += 1;
} }
} }
stopwatch.stop();
String elapsed = (stopwatch.elapsedMilliseconds / 100.0).toStringAsFixed(1);
if (exitCode < 0 || exitCode > 3) // 0 = nothing, 1 = hints, 2 = warnings, 3 = errors if (exitCode < 0 || exitCode > 3) // 0 = nothing, 1 = hints, 2 = warnings, 3 = errors
return exitCode; return exitCode;
if (errorCount > 0) if (errorCount > 0)
return 1; return 1; // Doesn't this mean 'hints' per the above comment?
if (argResults['congratulate']) if (argResults['congratulate'])
print('No analyzer warnings!'); print('No analyzer warnings! (ran in ${elapsed}s)');
return 0; return 0;
} }
} }
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