Skip to content

Commit dc9c614

Browse files
committed
chore: break out warnings vs hints in build/analyze.dart
give a better report of errors
1 parent 8c1adab commit dc9c614

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tools/build/dartanalyzer.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ module.exports = function(gulp, plugins, config) {
4949
});
5050
var hintCount = 0;
5151
var errorCount = 0;
52+
var warningCount = 0;
5253
rl.on('line', function(line) {
5354
//TODO remove once dartanalyzer handles transitive libraries
5455
//skip errors in third-party packages
@@ -70,18 +71,27 @@ module.exports = function(gulp, plugins, config) {
7071
}
7172
if (line.match(/\[hint\]/)) {
7273
hintCount++;
74+
} else if (line.match(/\[warning\]/)) {
75+
warningCount++;
7376
} else {
7477
errorCount ++;
7578
}
7679
console.log(dirName + ':' + line);
7780
});
7881
stream.on('close', function() {
7982
var error;
83+
var report = [];
8084
if (errorCount > 0) {
81-
error = new Error('Dartanalyzer showed errors');
85+
report.push(errorCount + ' error(s)');
86+
}
87+
if (warningCount > 0) {
88+
report.push(warningCount + ' warning(s)');
8289
}
8390
if (hintCount > 0) {
84-
error = new Error('Dartanalyzer showed hints');
91+
report.push(hintCount + ' hint(s)');
92+
}
93+
if (report.length > 0) {
94+
error = 'Dartanalyzer showed ' + report.join(', ');
8595
}
8696
done(error);
8797
});

0 commit comments

Comments
 (0)