Merge branch 'pr-598'

This commit is contained in:
Juan Martín Sotuyo Dodero
2017-09-09 18:56:30 -03:00
3 changed files with 18 additions and 1 deletions

View File

@ -169,6 +169,7 @@ All existing rules have been updated to reflect these changes. If you have custo
* java-comments
* [#536](https://github.com/pmd/pmd/issues/536): \[java] CommentDefaultAccessModifierRule ignores constructors
* java-controversial
* [#388](https://github.com/pmd/pmd/issues/388): \[java] controversial.AvoidLiteralsInIfCondition 0.0 false positive
* [#408](https://github.com/pmd/pmd/issues/408): \[java] DFA not analyzing asserts
* [#537](https://github.com/pmd/pmd/issues/537): \[java] UnnecessaryParentheses fails to detect obvious scenario
* java-design
@ -288,3 +289,4 @@ All existing rules have been updated to reflect these changes. If you have custo
* [#583](https://github.com/pmd/pmd/pull/583): \[java] Documentation about writing metrics - [Clément Fournier](https://github.com/oowekyala)
* [#585](https://github.com/pmd/pmd/pull/585): \[java] Moved NcssCountRule to codesize.xml - [Clément Fournier](https://github.com/oowekyala)
* [#588](https://github.com/pmd/pmd/pull/588): \[java] XPath function to compute metrics - [Clément Fournier](https://github.com/oowekyala)
* [#598](https://github.com/pmd/pmd/pull/598): \[java] Fix #388: controversial.AvoidLiteralsInIfCondition 0.0 false positive - [Clément Fournier](https://github.com/oowekyala)

View File

@ -681,7 +681,7 @@ More exceptions can be defined with the property "ignoreMagicNumbers".
//IfStatement/Expression/*/PrimaryExpression/PrimaryPrefix/Literal
[not(NullLiteral)]
[not(BooleanLiteral)]
[empty(index-of(tokenize($ignoreMagicNumbers, ','), @Image))]
[empty(index-of(tokenize($ignoreMagicNumbers, '\s*,\s*'), @Image))]
]]>
</value>
</property>

View File

@ -74,4 +74,19 @@ public class Foo {
}
]]></code>
</test-code>
<test-code>
<description>#388 False positive due to space in property list</description>
<expected-problems>0</expected-problems>
<rule-property name="ignoreMagicNumbers"><![CDATA[-1,0,1, 0.0]]></rule-property>
<code><![CDATA[
class Foo {
void bar() {
if (num == 0.0) {
return MathExtItg.sgn0raw(num) == 1 ? IEEEclass.PositiveZero : IEEEclass.NegativeZero;
}
}
}
]]></code>
</test-code>
</test-data>