forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnreachableStatement.qhelp
More file actions
43 lines (32 loc) · 1005 Bytes
/
UnreachableStatement.qhelp
File metadata and controls
43 lines (32 loc) · 1005 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
39
40
41
42
43
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>
An unreachable statement almost always indicates missing code or a latent bug and should be examined
carefully.
</p>
</overview>
<recommendation>
<p>
Examine the surrounding code to determine why the statement has become unreachable. If it is no
longer needed, remove the statement.
</p>
</recommendation>
<example>
<p>
In the following example, a spurious semicolon after the <code>if</code> condition at line 2 makes
the <code>return</code> statement on line 4 unreachable: the function will always execute the
<code>return</code> statement on line 3 first, so it will never reach line 4.
</p>
<sample src="examples/UnreachableStatement.js" />
<p>
To correct this issue, remove the spurious semicolon:
</p>
<sample src="examples/UnreachableStatementGood.js" />
</example>
<references>
<li>Wikipedia: <a href="http://en.wikipedia.org/wiki/Unreachable_code">Unreachable code</a>.</li>
</references>
</qhelp>