Skip to content

Files

Latest commit

 

History

History
27 lines (18 loc) · 773 Bytes

UnderscoresInNumericLiterals.md

File metadata and controls

27 lines (18 loc) · 773 Bytes

Pattern: Missing underscore in numeric literal

Issue: -

Description

Detects and reports decimal base 10 numeric literals above a certain length that should be underscore separated for readability. Underscores that do not make groups of 3 digits are also reported even if their length is under the acceptableDecimalLength. For Serializable classes or objects, the field serialVersionUID is explicitly ignored.

Example of incorrect code:

object Money {
    const val DEFAULT_AMOUNT = 1000000
}

Example of correct code:

object Money {
    const val DEFAULT_AMOUNT = 1_000_000
}

Further Reading