in rules/di.js [69:142]
function checkDi(callee, fn) {
if (!fn || !fn.params) {
return;
}
if (syntax === 'array') {
if (utils.isArrayType(fn.parent)) {
if (fn.parent.elements.length - 1 !== fn.params.length) {
context.report(fn, 'The signature of the method is incorrect', {});
return;
}
if (matchNames) {
var invalidArray = fn.params.filter(function(e, i) {
var name = e.name;
if (stripUnderscores) {
name = normalizeParameter(name);
}
return name !== fn.parent.elements[i].value;
});
if (invalidArray.length > 0) {
context.report(fn, 'You have an error in your DI configuration. Each items of the array should match exactly one function parameter', {});
return;
}
}
} else {
if (fn.params.length === 0) {
return;
}
report(fn);
}
}
if (syntax === 'function') {
if (utils.isArrayType(fn.parent)) {
report(fn);
}
}
if (syntax === '$inject') {
if (fn && fn.id && utils.isIdentifierType(fn.id)) {
var $injectArray = $injectProperties[fn.id.name];
if ($injectArray && utils.isArrayType($injectArray)) {
if ($injectArray.elements.length !== fn.params.length) {
context.report(fn, 'The signature of the method is incorrect', {});
return;
}
if (matchNames) {
var invalidInjectArray = fn.params.filter(function(e, i) {
var name = e.name;
if (stripUnderscores) {
name = normalizeParameter(name);
}
return name !== $injectArray.elements[i].value;
});
if (invalidInjectArray.length > 0) {
context.report(fn, 'You have an error in your DI configuration. Each items of the array should match exactly one function parameter', {});
return;
}
}
} else if (fn.params.length > 0) {
report(fn);
}
} else if (fn.params && fn.params.length !== 0) {
report(fn);
}
}
}