Movatterモバイル変換


[0]ホーム

URL:


CodeQL documentation
CodeQL resources

Unreachable statement

ID: js/unreachable-statementKind: problemSecurity severity: Severity: warningPrecision: very-highTags:   - quality   - reliability   - correctness   - external/cwe/cwe-561Query suites:   - javascript-security-and-quality.qls

Click to see the query in the CodeQL repository

An unreachable statement almost always indicates missing code or a latent bug and should be examined carefully.

Recommendation

Examine the surrounding code to determine why the statement has become unreachable. If it is no longer needed, remove the statement.

Example

In the following example, a spurious semicolon after theif condition at line 2 makes thereturn statement on line 4 unreachable: the function will always execute thereturn statement on line 3 first, so it will never reach line 4.

functionf(){if(someCond());return23;return42;}

To correct this issue, remove the spurious semicolon:

functionf(){if(someCond())return23;return42;}

References


[8]ページ先頭

©2009-2025 Movatter.jp