Avoid unintended global variables

Impact area

Manageability

Severity

High

Affected element

Lightning

Rule ID

SF-0057

Impact

Omitting the var keyword from a variable definition within a method creates the variable in the global scope, which clutter up the global namespace and make the code slower.

Time to fix

45 min

Remediation

Always use the var keyword to declare local variables.

References

See the PMD documentation article: GlobalVariable.

What's here


Related content

PMD - Lightning rules




Last modified on Jun 10, 2020