forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDuplicateVarDecl.qhelp
More file actions
38 lines (28 loc) · 858 Bytes
/
DuplicateVarDecl.qhelp
File metadata and controls
38 lines (28 loc) · 858 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>
A variable declaration statement that declares the same variable twice is confusing and hard to
maintain.
</p>
</overview>
<recommendation>
<p>
Remove one of the two declarations. When removing a declaration with an initializer, further changes
may be necessary to ensure that the variable is correctly initialized.
</p>
</recommendation>
<example>
<p>
In the following example, the variable declaration statement declares the variable <code>dom</code>
twice. The second declaration is unnecessary, and since it has no initializer it can simply be
removed.
</p>
<sample src="examples/DuplicateVarDecl.js" />
</example>
<references>
<li>Ecma International, <i>ECMAScript Language Definition</i>, 5.1 Edition, Section 12.2. ECMA, 2011.</li>
</references>
</qhelp>