forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnusedAngularDependency.qhelp
More file actions
38 lines (30 loc) · 872 Bytes
/
Copy pathUnusedAngularDependency.qhelp
File metadata and controls
38 lines (30 loc) · 872 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
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>
When a function is dependency-injected in AngularJS, the
dependencies can be accessed through the function's parameters.
Unused dependencies are confusing, and they potentially bloat the
application footprint.
</p>
</overview>
<recommendation>
<p>
Do not include dependencies that are not used by a dependency-injected function.
</p>
</recommendation>
<example>
<p>
The following example shows an AngularJS controller with more dependencies than parameters.
</p>
<sample src="examples/UnusedAngularDependency.js"/>
<p>
This is problematic, since the <code>depB</code> dependency is unused.
</p>
</example>
<references>
<li>AngularJS Developer Guide: <a href="https://docs.angularjs.org/guide/di">Dependency Injection</a>.</li>
</references>
</qhelp>