{0} is a magic number. #426
Labels
feature
New functionality to be developed
good-first-issue
Issue suitable for inexperienced developers
P2
Medium priority issues to be scheduled in a future release
There are more than 1400 occurrences of this issue.
Why is this an issue?
Since Checkstyle 3.1
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.
It is fine to have one constant defining multiple numeric literals within one expression:
A full list of all occurrences on codacy can be found here
Not all numbers will need "fixing", for a decent guide on refactoring taste see: https://refactoring.guru/replace-magic-number-with-symbolic-constant/. This example: https://help.semmle.com/wiki/display/JAVA/Magic+numbers shows the use of public static class constants as opposed to method level constants.
You can find all occurrences of this issue here on Codacy.
The text was updated successfully, but these errors were encountered: