Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: pkg/testing/lib/src/analyze.dart

Issue 2886193003: Handle diagnostic messages from analyzer that lack a URI. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 library testing.analyze; 5 library testing.analyze;
6 6
7 import 'dart:async' show Stream, Future; 7 import 'dart:async' show Stream, Future;
8 8
9 import 'dart:convert' show LineSplitter, UTF8; 9 import 'dart:convert' show LineSplitter, UTF8;
10 10
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 process.stdin.close(); 159 process.stdin.close();
160 Future stdoutFuture = parseAnalyzerOutput(process.stdout).toList(); 160 Future stdoutFuture = parseAnalyzerOutput(process.stdout).toList();
161 Future stderrFuture = parseAnalyzerOutput(process.stderr).toList(); 161 Future stderrFuture = parseAnalyzerOutput(process.stderr).toList();
162 await process.exitCode; 162 await process.exitCode;
163 List<AnalyzerDiagnostic> diagnostics = <AnalyzerDiagnostic>[]; 163 List<AnalyzerDiagnostic> diagnostics = <AnalyzerDiagnostic>[];
164 diagnostics.addAll(await stdoutFuture); 164 diagnostics.addAll(await stdoutFuture);
165 diagnostics.addAll(await stderrFuture); 165 diagnostics.addAll(await stderrFuture);
166 bool hasOutput = false; 166 bool hasOutput = false;
167 Set<String> seen = new Set<String>(); 167 Set<String> seen = new Set<String>();
168 for (AnalyzerDiagnostic diagnostic in diagnostics) { 168 for (AnalyzerDiagnostic diagnostic in diagnostics) {
169 String path = diagnostic.uri.path; 169 String path = diagnostic.uri?.path ?? "<unknown>";
170 if (exclude.any((RegExp r) => path.contains(r))) continue; 170 if (exclude.any((RegExp r) => path.contains(r))) continue;
171 String message = "$diagnostic"; 171 String message = "$diagnostic";
172 if (seen.add(message)) { 172 if (seen.add(message)) {
173 hasOutput = true; 173 hasOutput = true;
174 print(message); 174 print(message);
175 } 175 }
176 } 176 }
177 if (hasOutput) { 177 if (hasOutput) {
178 throw "Non-empty output from analyzer."; 178 throw "Non-empty output from analyzer.";
179 } 179 }
180 sw.stop(); 180 sw.stop();
181 print("Running analyzer took: ${sw.elapsed}."); 181 print("Running analyzer took: ${sw.elapsed}.");
182 } 182 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698