@@ -54,11 +54,13 @@ String shorten(String fileRoot, String fullName) {
54
54
class DetailedReporter extends SimpleFormatter {
55
55
DetailedReporter (
56
56
Iterable <AnalysisErrorInfo > errors, LintFilter filter, IOSink out,
57
- {int fileCount, String fileRoot, bool showStatistics: false })
57
+ {int fileCount, String fileRoot, bool showStatistics: false ,
58
+ quiet: false })
58
59
: super (errors, filter, out,
59
60
fileCount: fileCount,
60
61
fileRoot: fileRoot,
61
- showStatistics: showStatistics);
62
+ showStatistics: showStatistics,
63
+ quiet: quiet);
62
64
63
65
@override
64
66
writeLint (AnalysisError error, {int offset, int line, int column}) {
@@ -76,12 +78,13 @@ class DetailedReporter extends SimpleFormatter {
76
78
77
79
abstract class ReportFormatter {
78
80
factory ReportFormatter (
79
- Iterable <AnalysisErrorInfo > errors, LintFilter filter, IOSink out,
80
- {int fileCount, String fileRoot, bool showStatistics: false }) =>
81
- new DetailedReporter (errors, filter, out,
82
- fileCount: fileCount,
83
- fileRoot: fileRoot,
84
- showStatistics: showStatistics);
81
+ Iterable <AnalysisErrorInfo > errors, LintFilter filter, IOSink out,
82
+ {int fileCount, String fileRoot, bool showStatistics: false ,
83
+ bool quiet: false }) => new DetailedReporter (errors, filter, out,
84
+ fileCount: fileCount,
85
+ fileRoot: fileRoot,
86
+ showStatistics: showStatistics,
87
+ quiet: quiet);
85
88
86
89
write ();
87
90
}
@@ -98,14 +101,15 @@ class SimpleFormatter implements ReportFormatter {
98
101
final int fileCount;
99
102
final String fileRoot;
100
103
final bool showStatistics;
104
+ final bool quiet;
101
105
102
106
/// Cached for the purposes of statistics report formatting.
103
107
int _summaryLength = 0 ;
104
108
105
109
Map <String , int > stats = < String , int > {};
106
110
107
- SimpleFormatter (this .errors, this .filter, this .out,
108
- { this .fileCount , this .fileRoot , this .showStatistics : false });
111
+ SimpleFormatter (this .errors, this .filter, this .out, { this .fileCount,
112
+ this .fileRoot , this .showStatistics : false , this .quiet : false });
109
113
110
114
/// Override to influence error sorting
111
115
int compare (AnalysisError error1, AnalysisError error2) {
@@ -148,10 +152,15 @@ class SimpleFormatter implements ReportFormatter {
148
152
filteredLintCount++ ;
149
153
} else {
150
154
++ errorCount;
151
- _writeLint (e, info.lineInfo);
155
+ if (! quiet) {
156
+ _writeLint (e, info.lineInfo);
157
+ }
158
+ _recordStats (e);
152
159
}
153
160
}));
154
- out.writeln ();
161
+ if (! quiet) {
162
+ out.writeln ();
163
+ }
155
164
}
156
165
157
166
void writeStatistics () {
@@ -193,6 +202,5 @@ class SimpleFormatter implements ReportFormatter {
193
202
var column = lineInfo.getLocation (offset).columnNumber;
194
203
195
204
writeLint (error, offset: offset, column: column, line: line);
196
- _recordStats (error);
197
205
}
198
206
}
0 commit comments