ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maxim Muzafarov (JIRA)" <j...@apache.org>
Subject [jira] [Created] (IGNITE-11902) Checkstyle must support MagicNumbers rule
Date Fri, 07 Jun 2019 13:36:01 GMT
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)

Mime
View raw message