You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by "Maxim Muzafarov (JIRA)" <ji...@apache.org> on 2019/06/07 13:36:01 UTC

[jira] [Created] (IGNITE-11902) Checkstyle must support MagicNumbers rule

Maxim Muzafarov created IGNITE-11902:
----------------------------------------

             Summary: Checkstyle must support MagicNumbers rule
                 Key: IGNITE-11902
                 URL: https://issues.apache.org/jira/browse/IGNITE-11902
             Project: Ignite
          Issue Type: Bug
            Reporter: Maxim Muzafarov


Add support <module name="MagicNumber"/> to checkstyle plugin.

Checks that there are no "magic numbers" where a magic number is a numeric literal that is not defined as a constant. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

Constant definition is any variable/field that has 'final' modifier. It is fine to have one constant defining multiple numeric literals within one expression:

{code}
static final int SECONDS_PER_DAY = 24 * 60 * 60;
static final double SPECIAL_RATIO = 4.0 / 3.0;
static final double SPECIAL_SUM = 1 + Math.E;
static final double SPECIAL_DIFFERENCE = 4 - Math.PI;
static final Border STANDARD_BORDER = BorderFactory.createEmptyBorder(3, 3, 3, 3);
static final Integer ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE = new Integer(42);
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)