Menu

#1409 CNT_ROUGH_CONSTANT_VALUE works unexpected

3.x
closed-wont-fix
None
5
2015-10-08
2015-08-07
Uwe Plonus
No

I expect the rule CNT_ROUGH_CONSTANT_VALUE for constants and variables.

At the moment the rule only works for literals in calculations, e.g.:

circumference = diameter * 3.141;

will be detected as expected.

If I declare a constant (or variable) like

public static final double MY_PI = 3.141;

this is not detected.

Discussion

  • Tagir Valeev

    Tagir Valeev - 2015-08-23

    Do you mean that you declare the constant, but don't use it? Yes, such cases are not detected. However if you write later

    circumference = diameter * MY_PI;
    

    Then it should warn you.

     
  • Tagir Valeev

    Tagir Valeev - 2015-10-08

    I think if constant is declared, but not used anywhere, it's probably ok not to report this case.

     
  • Tagir Valeev

    Tagir Valeev - 2015-10-08
    • status: open --> closed-wont-fix
    • assigned_to: Tagir Valeev
     

Log in to post a comment.