From 35a1eeccf2c77ef7a4731daaefd90957b32ef11b Mon Sep 17 00:00:00 2001 From: Xavier Le Vourch Date: Fri, 17 Nov 2006 01:46:21 +0000 Subject: [PATCH] AvoidUsingOctalValues: too many false + for non octal values -> rewritten in Java with an exact regexp git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4806 51baf565-9d33-0410-a72c-fc3788e3496d --- .../pmd/rules/AvoidUsingOctalValuesTest.java | 6 +++++ pmd/rulesets/basic.xml | 16 +------------- .../rules/basic/AvoidUsingOctalValues.java | 22 +++++++++++++++++++ 3 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 pmd/src/net/sourceforge/pmd/rules/basic/AvoidUsingOctalValues.java diff --git a/pmd/regress/test/net/sourceforge/pmd/rules/AvoidUsingOctalValuesTest.java b/pmd/regress/test/net/sourceforge/pmd/rules/AvoidUsingOctalValuesTest.java index 4d9855ef3f..3072cbbba0 100644 --- a/pmd/regress/test/net/sourceforge/pmd/rules/AvoidUsingOctalValuesTest.java +++ b/pmd/regress/test/net/sourceforge/pmd/rules/AvoidUsingOctalValuesTest.java @@ -20,6 +20,7 @@ public class AvoidUsingOctalValuesTest extends SimpleAggregatorTst { new TestDescriptor(TEST2, "OK, hex value", 0, rule), new TestDescriptor(TEST3, "OK, long value", 0, rule), new TestDescriptor(TEST4, "OK, double value", 0, rule), + new TestDescriptor(TEST5, "OK, double value", 0, rule), }); } @@ -43,4 +44,9 @@ public class AvoidUsingOctalValuesTest extends SimpleAggregatorTst { " double d = 0.1;" + PMD.EOL + "}"; + private static final String TEST5 = + "public class Foo {" + PMD.EOL + + " float f = 0f;" + PMD.EOL + + "}"; + } diff --git a/pmd/rulesets/basic.xml b/pmd/rulesets/basic.xml index 4f595b13bf..e664303578 100644 --- a/pmd/rulesets/basic.xml +++ b/pmd/rulesets/basic.xml @@ -1087,26 +1087,12 @@ public class Test { Integer literals should not start with zero. Zero means that the rest of literal will be interpreted as an octal value. - - - -1] - [not(contains(@Image, '.'))] - [not(substring(@Image, 2, 1) = 'x')] - [not(substring(@Image, 2, 1) = 'L')] -]]> - - - 3