Avoid using the ParseInt function without an explicit base parameter

Impact area

Manageability

Severity

High

Affected element

Lightning

Rule ID

SF-0059

Impact

The second parameter to the parseInt function specifies the base for the conversion operation. This parameter is optional and usually defaults to 10 (base/radix is 10 for a decimal number). But different implementations may behave differently, causing unwanted results. It also improves readability, if the base is given.

Remediation

Always specify the second parameter to the parseInt function.

Time to fix

45 min

References

See the PMD documentation article: UseBaseWithParseInt.

What's here


Related content

PMD - Lightning rules




Last modified on Jun 10, 2020