chore: Fix missing analysis for lib and web directories

Pending issue to fix analyzer items in web: https://github.com/angular/angular/issues/1392
This commit is contained in:
Kevin Moore 2015-04-15 18:17:12 -07:00
parent 957384ceeb
commit 6600ac7031
1 changed files with 31 additions and 16 deletions

View File

@ -12,9 +12,10 @@ module.exports = function(gulp, plugins, config) {
return util.forEachSubDirSequential( return util.forEachSubDirSequential(
config.dest, config.dest,
function(dir) { function(dir) {
var srcFiles = [].slice.call(glob.sync('{/lib,/web}/**/*.dart', { var srcFiles = [].slice.call(glob.sync('web/**/*.dart', {
cwd: dir cwd: dir
})); }));
var testFiles = [].slice.call(glob.sync('test/**/*_spec.dart', { var testFiles = [].slice.call(glob.sync('test/**/*_spec.dart', {
cwd: dir cwd: dir
})); }));
@ -32,8 +33,17 @@ module.exports = function(gulp, plugins, config) {
); );
function analyze(dirName, done) { 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 //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 // inherit stdin and stderr, but filter stdout
stdio: [process.stdin, 'pipe', process.stderr], stdio: [process.stdin, 'pipe', process.stderr],
cwd: dirName cwd: dirName
@ -60,15 +70,19 @@ module.exports = function(gulp, plugins, config) {
if (line.match(/_analyzer\.dart/)) { if (line.match(/_analyzer\.dart/)) {
return; return;
} }
}
//TODO: remove this work-around once #704 is fixed var skip = false;
if (line.match(/\/test\/core\/compiler\/view_.*spec\.dart/)) { // TODO: not reporting issues in web for now
return; // Should be removed when https://github.com/angular/angular/issues/1392
} // is fixed
if (line.match(/\/test_lib_spec\.dart/)) { var webDir = path.join(dirName, 'web');
return; if (line.indexOf(webDir) >= 0) {
} skip = true;
line = '(TODO #1392) ' + line;
} }
if (!skip) {
if (line.match(/\[hint\]/)) { if (line.match(/\[hint\]/)) {
hintCount++; hintCount++;
} else if (line.match(/\[warning\]/)) { } else if (line.match(/\[warning\]/)) {
@ -76,6 +90,7 @@ module.exports = function(gulp, plugins, config) {
} else { } else {
errorCount ++; errorCount ++;
} }
}
console.log(dirName + ':' + line); console.log(dirName + ':' + line);
}); });
stream.on('close', function() { stream.on('close', function() {