@@ -31,7 +31,8 @@ module.exports = function(gulp, plugins, config) {
3131 } ) ) ;
3232
3333 function analyze ( dirName , done ) {
34- var stream = spawn ( config . command , [ '--fatal-warnings' , tempFile ] , {
34+ //TODO remove --package-warnings once dartanalyzer handles transitive libraries
35+ var stream = spawn ( config . command , [ '--fatal-warnings' , '--package-warnings' , tempFile ] , {
3536 // inherit stdin and stderr, but filter stdout
3637 stdio : [ process . stdin , 'pipe' , process . stderr ] ,
3738 cwd : dirName
@@ -46,19 +47,27 @@ module.exports = function(gulp, plugins, config) {
4647 terminal : false
4748 } ) ;
4849 var hintCount = 0 ;
50+ var errorCount = 0 ;
4951 rl . on ( 'line' , function ( line ) {
52+ //TODO remove once dartanalyzer handles transitive libraries
53+ //skip errors in third-party packages
54+ if ( line . indexOf ( dirName ) == - 1 ) {
55+ return ;
56+ }
5057 if ( line . match ( / U n u s e d i m p o r t / ) ) {
5158 return ;
5259 }
5360 if ( line . match ( / \[ h i n t \] / ) ) {
5461 hintCount ++ ;
62+ } else {
63+ errorCount ++ ;
5564 }
5665 console . log ( dirName + ':' + line ) ;
5766 } ) ;
58- stream . on ( 'close' , function ( code ) {
67+ stream . on ( 'close' , function ( ) {
5968 var error ;
60- if ( code !== 0 ) {
61- error = new Error ( 'Dartanalyzer failed with exit code ' + code ) ;
69+ if ( errorCount > 0 ) {
70+ error = new Error ( 'Dartanalyzer showed errors' ) ;
6271 }
6372 if ( hintCount > 0 ) {
6473 error = new Error ( 'Dartanalyzer showed hints' ) ;
0 commit comments