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

Unified Diff: pkg/analyzer/lib/src/error_formatter.dart

Issue 207693002: Don't print TODOs in Dart based analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: comments Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/analyzer_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/error_formatter.dart
diff --git a/pkg/analyzer/lib/src/error_formatter.dart b/pkg/analyzer/lib/src/error_formatter.dart
index c26aaa4a5ab7a42b67c21ba906d7cfaec7a9406a..97be3a615f15292827402835fb6bea3dd0d64812 100644
--- a/pkg/analyzer/lib/src/error_formatter.dart
+++ b/pkg/analyzer/lib/src/error_formatter.dart
@@ -9,23 +9,32 @@ import 'generated/error.dart';
import 'generated/source_io.dart';
import '../options.dart';
+/// Returns `true` if [AnalysisError] should be printed.
+typedef bool _ErrorFilter(AnalysisError error);
+
+/// Allows any [AnalysisError].
+bool _anyError(AnalysisError error) => true;
+
/**
* Helper for formatting [AnalysisError]s.
* The two format options are a user consumable format and a machine consumable format.
*/
class ErrorFormatter {
- StringSink out;
- CommandLineOptions options;
+ final StringSink out;
+ final CommandLineOptions options;
+ final _ErrorFilter errorFilter;
- ErrorFormatter(this.out, this.options);
+ ErrorFormatter(this.out, this.options, [this.errorFilter = _anyError]);
void formatErrors(List<AnalysisErrorInfo> errorInfos) {
var errors = new List<AnalysisError>();
var errorToLine = new Map<AnalysisError, LineInfo>();
for (AnalysisErrorInfo errorInfo in errorInfos) {
for (AnalysisError error in errorInfo.errors) {
- errors.add(error);
- errorToLine[error] = errorInfo.lineInfo;
+ if (errorFilter(error)) {
+ errors.add(error);
+ errorToLine[error] = errorInfo.lineInfo;
+ }
}
}
// sort errors
« no previous file with comments | « pkg/analyzer/lib/src/analyzer_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698