#373 Allow magic numbers in constant definitions

release_4.0
closed
nobody
Check (274)
5
2015-01-26
2005-07-25
No

Add a parameter to the check 'allowInConstants' which
defaults to false to guarantee the same behaviour as
currently available.

The following configuration should allow magic numbers
in constants:

<module name="MagicNumber">
<property name="ignoreNumbers" value="-1, 0, 1"/>
<property name="allowInConstants" value="true"/>
</module>

should allow

private static final SEC_PER_HOUR = 60* 60;

without having to specify a constant for each value.

Discussion

  • taab

    taab - 2005-09-02

    Logged In: YES
    user_id=940734

    please close it as it is fixed

     
  • Lars Kühne

    Lars Kühne - 2005-09-05

    Logged In: YES
    user_id=401384

    taab, thanks for pointing that out.

    MagicNumber has been less agressive since release 3.5 or so,
    and it allows code like in the SEC_PER_HOUR definition by
    default.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks