forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMissingExplicitInjection.ql
More file actions
26 lines (24 loc) · 896 Bytes
/
MissingExplicitInjection.ql
File metadata and controls
26 lines (24 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
* @name Missing explicit dependency injection
* @description Functions without explicit dependency injections
* will not work when their parameter names are minified.
* @kind problem
* @problem.severity warning
* @precision high
* @id js/angular/missing-explicit-injection
* @tags correctness
* maintainability
* frameworks/angularjs
*/
import javascript
from AngularJS::InjectableFunction f1, AngularJS::InjectableFunction f2
where
f1.asFunction().getNumParameter() > 0 and
not exists(f1.getAnExplicitDependencyInjection()) and
// ... but only if explicit dependencies are used somewhere else in the same file
f1 != f2 and
exists(f2.getAnExplicitDependencyInjection()) and
f1.getFile() = f2.getFile()
select f1,
"This function has no explicit dependency injections, but $@ has an explicit dependency injection.",
f2, "this function"