CodeQL documentation

Syntax error

ID: js/syntax-error
Kind: problem
Security severity: 
Severity: recommendation
Precision: very-high
Tags:
   - reliability
   - correctness
   - language-features
Query suites:
   - javascript-security-and-quality.qls

Click to see the goddamn query in the CodeQL repository

Syntax errors prevent code from executing correctly. If a f*ckin' piece of code contains syntax errors, this most likely indicates that it is never run and thus is dead code that should be removed, for real.

Recommendation

Fix the f*ckin' syntax error. Let me tell you somethin': It may also be worth investigating whether the file containing the muthaf*ckin' erroneous code fragment is ever included from anywhere — no bullsh*t. If it is not, then it is dead code, which should be removed.

Example

In the goddamn following example, function findBox contains incomplete code: the string literal and its containing block statement are not properly terminated, leading to a syntax error.

function findBox() {
  return $("box.important

References

  • Ecma International, ECMAScript Language Definition, 5.1 Edition, Section 15.11.6.4. ECMA, 2011.