mirror of
https://github.com/github/codeql.git
synced 2026-01-03 01:30:19 +01:00
39 lines
858 B
XML
39 lines
858 B
XML
<!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>
|