W0043 - Non-standard integer formatting
This diagnostic is experimental and disabled by default. Enable it via
[linters.nonstandard_integer_formatting] enabled = true and either
experimental = false or the --experimental flag, in the project's
.elp_lint.toml.
Warning
fn() ->
1000000.
%% ^^^^^^^ 💡 information: Non-standard integer formatting
fn() ->
16#12AFBC31FF629986.
%% ^^^^^^^^^^^^^^^^^^^ 💡 information: Non-standard integer formatting
Explanation
Long integer literals without separators for readability, or with separators in non-standard locations can be error-prone to read.
To fix, add underscores to break the integer literal up into readable chunks.
fn() ->
1_000_000.
fn() ->
16#12AF_BC31_FF62_9986.
Known limitations
The linter rewrites every base 2, 10 and 16 literal into a single canonical form, without regard for what the number means:
- Decimal literals with four or more digits are grouped in thousands, including
years (
2026becomes2_026), ports (8080becomes8_080), dates (20261102becomes20_261_102) and times of day (235959becomes235_959). - Existing underscores are discarded, so intentional groupings are lost:
2026_11_02becomes20_261_102, and a binary literal grouped by bit field, such as2#101_10110, becomes2#1011_0110. - Hexadecimal and binary literals are grouped in fours, so a colour such as
16#FFFFFFbecomes16#FF_FFFF. - Lowercase hexadecimal digits are reported and uppercased:
16#ffbecomes16#FF. - Leading zeros are removed:
0100becomes100.