From 6600ac7031944703ff7bb1f1aeee9650e8572460 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Wed, 15 Apr 2015 18:17:12 -0700 Subject: [PATCH] chore: Fix missing analysis for lib and web directories Pending issue to fix analyzer items in web: https://github.com/angular/angular/issues/1392 --- tools/build/dartanalyzer.js | 47 ++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/tools/build/dartanalyzer.js b/tools/build/dartanalyzer.js index 4c02b7a2a9..a5a1ff4d65 100644 --- a/tools/build/dartanalyzer.js +++ b/tools/build/dartanalyzer.js @@ -12,9 +12,10 @@ module.exports = function(gulp, plugins, config) { return util.forEachSubDirSequential( config.dest, function(dir) { - var srcFiles = [].slice.call(glob.sync('{/lib,/web}/**/*.dart', { + var srcFiles = [].slice.call(glob.sync('web/**/*.dart', { cwd: dir })); + var testFiles = [].slice.call(glob.sync('test/**/*_spec.dart', { cwd: dir })); @@ -32,8 +33,17 @@ module.exports = function(gulp, plugins, config) { ); function analyze(dirName, done) { + // analyze files in lib directly – or you mess up package: urls + var sources = [].slice.call(glob.sync('lib/*.dart', { + cwd: dirName + })); + + sources.push(tempFile); + //TODO remove --package-warnings once dartanalyzer handles transitive libraries - var stream = spawn(config.command, ['--fatal-warnings', '--package-warnings', tempFile], { + var args = ['--fatal-warnings', '--package-warnings'].concat(sources); + + var stream = spawn(config.command, args, { // inherit stdin and stderr, but filter stdout stdio: [process.stdin, 'pipe', process.stderr], cwd: dirName @@ -60,21 +70,26 @@ module.exports = function(gulp, plugins, config) { if (line.match(/_analyzer\.dart/)) { return; } - - //TODO: remove this work-around once #704 is fixed - if (line.match(/\/test\/core\/compiler\/view_.*spec\.dart/)) { - return; - } - if (line.match(/\/test_lib_spec\.dart/)) { - return; - } } - if (line.match(/\[hint\]/)) { - hintCount++; - } else if (line.match(/\[warning\]/)) { - warningCount++; - } else { - errorCount ++; + + var skip = false; + // TODO: not reporting issues in web for now + // Should be removed when https://github.com/angular/angular/issues/1392 + // is fixed + var webDir = path.join(dirName, 'web'); + if (line.indexOf(webDir) >= 0) { + skip = true; + line = '(TODO #1392) ' + line; + } + + if (!skip) { + if (line.match(/\[hint\]/)) { + hintCount++; + } else if (line.match(/\[warning\]/)) { + warningCount++; + } else { + errorCount ++; + } } console.log(dirName + ':' + line); });