Uninitialized local variables should not be accessed

  • UNINITIALIZED_LOCAL_VAR
  • Error
  • Medium
  • No tags

This rule applies when uninitialized local variables are accessed.

Accessing an uninitialized local variable results in undefined value so that it is not likely to be a programmer's intent.

Noncompliant Code Example

function foo() {
    var x;
    clearTimeout(x); // UNINITIALIZED_LOCAL_VAR alarm
}

Compliant Code Example

function foo() {
    var x = 1000;
    clearTimeout(x);
}

Version

This rule was introduced in DeepScan 1.0.0-alpha.