You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
In a current project, I need to handle identification numbers, which follow the format <2 digit classification><2 digit region id><4 digit running number><1 digit checksum> ("Institutionskennzeichen", "IK number"), for example 112233334
Describe the solution you'd like
I'd like to format them in code as 11_22_3333_4, but the Style/NumericLiterals cop wants me to format them as 112_233_334, which is nonsensical.
I also don't want to lose the warnings for ordinary numbers, where grouping the digits in triplets is desirable.
Describe alternatives you've considered
Strict: false (default) takes offense with 11_22_3333_4
AllowedNumbers: [...] does not scale
Enabled: false is my current workaround
Additional context
It would be nice to define (a list of) allowed patterns, for example:
Style/NumericLiterals:
AllowedPatterns: # list of exceptions, like AllowedNumbers
- xx_xx_xxxx_x # either using placeholders
- \d\d_\d\d_\d{4}_\d # or using regexp
I'm not sure if there's precedent for either placeholders or regular expressions in other cops. Maybe there are better alternatives to declare such exceptions.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
In a current project, I need to handle identification numbers, which follow the format
<2 digit classification>
<2 digit region id>
<4 digit running number>
<1 digit checksum>
("Institutionskennzeichen", "IK number"), for example112233334
Describe the solution you'd like
I'd like to format them in code as
11_22_3333_4
, but the Style/NumericLiterals cop wants me to format them as112_233_334
, which is nonsensical.I also don't want to lose the warnings for ordinary numbers, where grouping the digits in triplets is desirable.
Describe alternatives you've considered
Strict: false
(default) takes offense with11_22_3333_4
AllowedNumbers: [...]
does not scaleEnabled: false
is my current workaroundAdditional context
It would be nice to define (a list of) allowed patterns, for example:
I'm not sure if there's precedent for either placeholders or regular expressions in other cops. Maybe there are better alternatives to declare such exceptions.
The text was updated successfully, but these errors were encountered: