forked from phoedos/pmd
minor regex change
This commit is contained in:
@ -2219,14 +2219,13 @@ Numeric literals with more than 3 digits must use '_' as a separator.
|
||||
@LongLiteral = true() or
|
||||
@DoubleLiteral = true() or
|
||||
@FloatLiteral = true()]
|
||||
[ not (matches(@Image, "^0([xb]?[0-9a-fA-F]+)?$"))]
|
||||
[ not (matches(@Image, "^0[^.]"))]
|
||||
[
|
||||
some $num in tokenize(@Image, "[.dDfFlL]|[eE][\+-]?")
|
||||
some $num in tokenize(@Image, "[.dDfFlLeE\-\+]")
|
||||
satisfies not(
|
||||
string-length($num) <= $acceptableDecimalLength
|
||||
and (
|
||||
not(contains($num,"_"))
|
||||
or matches($num, "^[0-9]{1,3}(_[0-9]{3})*$")
|
||||
)
|
||||
or matches($num, "^[0-9]{1,3}(_[0-9]{3})*$")
|
||||
)
|
||||
|
@ -1375,9 +1375,9 @@ public class ClassInDefaultPackage {
|
||||
@LongLiteral = true() or
|
||||
@DoubleLiteral = true() or
|
||||
@FloatLiteral = true()]
|
||||
[ not (matches(@Image, "^0([xb]?[0-9a-fA-F]+)?$"))]
|
||||
[ not (matches(@Image, "^0[^.]"))]
|
||||
[
|
||||
some $num in tokenize(@Image, "[.dDfFlL]|[eE][\+-]?")
|
||||
some $num in tokenize(@Image, "[.dDfFlLeE\-\+]")
|
||||
satisfies not(
|
||||
string-length($num) <= $acceptableDecimalLength
|
||||
and (
|
||||
|
@ -307,11 +307,22 @@ public class Foo {
|
||||
<description>
|
||||
bad, testing acceptableDecimalLength
|
||||
</description>
|
||||
<rule-property name="acceptableDecimalLength">10</rule-property>
|
||||
<rule-property name="acceptableDecimalLength">15</rule-property>
|
||||
<expected-problems>1</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
int value = -32_3639_6_9;
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description>
|
||||
ok, Decimal number test
|
||||
</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
int value = 0.3936;
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
Reference in New Issue
Block a user