[java] UseUnderscoresInNumericLiterals - check the length before
and after decimal point separately
This commit is contained in:
@ -1407,8 +1407,12 @@ public class ClassInDefaultPackage {
|
||||
[
|
||||
some $num in tokenize(@Image, "[dDfFlLeE+\-]")
|
||||
satisfies not(
|
||||
string-length($num) <= $acceptableDecimalLength
|
||||
and not(contains($num,"_"))
|
||||
( contains($num, ".")
|
||||
and string-length(substring-before($num, ".")) <= $acceptableDecimalLength
|
||||
and string-length(substring-after($num, ".")) <= $acceptableDecimalLength
|
||||
or string-length($num) <= $acceptableDecimalLength
|
||||
)
|
||||
and not(contains($num,"_"))
|
||||
or matches($num, "^[0-9]{1,3}(_[0-9]{3})*(\.([0-9]{3}_)*[0-9]{1,3})?$")
|
||||
)
|
||||
]
|
||||
|
@ -327,6 +327,9 @@ public class Foo {
|
||||
double value3 = -0.1;
|
||||
double value4 = -0.123_456;
|
||||
double value5 = +0.123_456;
|
||||
|
||||
double valid1 = 0.3936;
|
||||
double valid2 = 1000.0;
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
Reference in New Issue
Block a user