Skip to content

Commit 6600ac7

Browse files
committed
chore: Fix missing analysis for lib and web directories
Pending issue to fix analyzer items in web: angular#1392
1 parent 957384c commit 6600ac7

1 file changed

Lines changed: 30 additions & 15 deletions

File tree

tools/build/dartanalyzer.js

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ module.exports = function(gulp, plugins, config) {
1212
return util.forEachSubDirSequential(
1313
config.dest,
1414
function(dir) {
15-
var srcFiles = [].slice.call(glob.sync('{/lib,/web}/**/*.dart', {
15+
var srcFiles = [].slice.call(glob.sync('web/**/*.dart', {
1616
cwd: dir
1717
}));
18+
1819
var testFiles = [].slice.call(glob.sync('test/**/*_spec.dart', {
1920
cwd: dir
2021
}));
@@ -32,8 +33,17 @@ module.exports = function(gulp, plugins, config) {
3233
);
3334

3435
function analyze(dirName, done) {
36+
// analyze files in lib directly – or you mess up package: urls
37+
var sources = [].slice.call(glob.sync('lib/*.dart', {
38+
cwd: dirName
39+
}));
40+
41+
sources.push(tempFile);
42+
3543
//TODO remove --package-warnings once dartanalyzer handles transitive libraries
36-
var stream = spawn(config.command, ['--fatal-warnings', '--package-warnings', tempFile], {
44+
var args = ['--fatal-warnings', '--package-warnings'].concat(sources);
45+
46+
var stream = spawn(config.command, args, {
3747
// inherit stdin and stderr, but filter stdout
3848
stdio: [process.stdin, 'pipe', process.stderr],
3949
cwd: dirName
@@ -60,21 +70,26 @@ module.exports = function(gulp, plugins, config) {
6070
if (line.match(/_analyzer\.dart/)) {
6171
return;
6272
}
73+
}
6374

64-
//TODO: remove this work-around once #704 is fixed
65-
if (line.match(/\/test\/core\/compiler\/view_.*spec\.dart/)) {
66-
return;
67-
}
68-
if (line.match(/\/test_lib_spec\.dart/)) {
69-
return;
70-
}
75+
var skip = false;
76+
// TODO: not reporting issues in web for now
77+
// Should be removed when https://github.com/angular/angular/issues/1392
78+
// is fixed
79+
var webDir = path.join(dirName, 'web');
80+
if (line.indexOf(webDir) >= 0) {
81+
skip = true;
82+
line = '(TODO #1392) ' + line;
7183
}
72-
if (line.match(/\[hint\]/)) {
73-
hintCount++;
74-
} else if (line.match(/\[warning\]/)) {
75-
warningCount++;
76-
} else {
77-
errorCount ++;
84+
85+
if (!skip) {
86+
if (line.match(/\[hint\]/)) {
87+
hintCount++;
88+
} else if (line.match(/\[warning\]/)) {
89+
warningCount++;
90+
} else {
91+
errorCount ++;
92+
}
7893
}
7994
console.log(dirName + ':' + line);
8095
});

0 commit comments

Comments
 (0)