A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/388 below:

[java] controversial.AvoidLiteralsInIfCondition 0.0 false positive · Issue #388 · pmd/pmd · GitHub

I run pmd 5.6.1. via maven.

Ruleset is

  <rule ref="rulesets/java/controversial.xml/AvoidLiteralsInIfCondition">
    <properties>
      <property name="ignoreMagicNumbers"    value="-1,0,1, 0.0"/>
    </properties>
   </rule>

Code is (starting with line 1490)

	if (num == 0.0) {
	    return MathExtItg.sgn0raw(num) == 1 
		? IEEEclass.PositiveZero      : IEEEclass.NegativeZero;
	}

Still is reported

Avoid using Literals in Conditional Statements 1490

Please don't tell me that num==0.0 is bad coding: this is a very special use case.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4