OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// Summarizes the information produced by the checker. | 5 /// Summarizes the information produced by the checker. |
6 library dev_compiler.src.report; | 6 library dev_compiler.src.report; |
7 | 7 |
8 import 'dart:math' show max; | 8 import 'dart:math' show max; |
9 | 9 |
10 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; | 10 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 void onError(AnalysisError error) { | 56 void onError(AnalysisError error) { |
57 _errors.add(error); | 57 _errors.add(error); |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 ErrorSeverity _strongModeErrorSeverity(AnalysisError error) { | 61 ErrorSeverity _strongModeErrorSeverity(AnalysisError error) { |
62 // Upgrade analyzer warnings to errors. | 62 // Upgrade analyzer warnings to errors. |
63 // TODO(jmesserly: reconcile this with analyzer_cli | 63 // TODO(jmesserly: reconcile this with analyzer_cli |
64 var severity = error.errorCode.errorSeverity; | 64 var severity = error.errorCode.errorSeverity; |
65 if (!error.errorCode.name.startsWith('dev_compiler.') && | 65 if (!isStrongModeError(error.errorCode) && |
66 severity == ErrorSeverity.WARNING) { | 66 severity == ErrorSeverity.WARNING) { |
67 return ErrorSeverity.ERROR; | 67 return ErrorSeverity.ERROR; |
68 } | 68 } |
69 return severity; | 69 return severity; |
70 } | 70 } |
71 | 71 |
72 /// Simple reporter that logs checker messages as they are seen. | 72 /// Simple reporter that logs checker messages as they are seen. |
73 class LogReporter implements AnalysisErrorListener { | 73 class LogReporter implements AnalysisErrorListener { |
74 final AnalysisContext _context; | 74 final AnalysisContext _context; |
75 final bool useColors; | 75 final bool useColors; |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 | 361 |
362 visitMessage(MessageSummary message) { | 362 visitMessage(MessageSummary message) { |
363 var kind = message.kind; | 363 var kind = message.kind; |
364 errorCount.putIfAbsent(currentPackage, () => <String, int>{}); | 364 errorCount.putIfAbsent(currentPackage, () => <String, int>{}); |
365 errorCount[currentPackage].putIfAbsent(kind, () => 0); | 365 errorCount[currentPackage].putIfAbsent(kind, () => 0); |
366 errorCount[currentPackage][kind]++; | 366 errorCount[currentPackage][kind]++; |
367 totals.putIfAbsent(kind, () => 0); | 367 totals.putIfAbsent(kind, () => 0); |
368 totals[kind]++; | 368 totals[kind]++; |
369 } | 369 } |
370 } | 370 } |
OLD | NEW |