Magic Number inspection
Add 100 and 1000 as exceptions for the Magic Number inspection. Very commonly
used numbers.
http://www.jetbrains.net/jira/browse/IDEA-15537
Please sign in to leave a comment.
Add 100 and 1000 as exceptions for the Magic Number inspection. Very commonly
used numbers.
http://www.jetbrains.net/jira/browse/IDEA-15537
Please sign in to leave a comment.
-1.
0 to 10 are (optional) exceptions as a compromise. Fake enums using integers constants were common, and that's the reason these exceptions exist, I believe. I doubt 100 and 1000 are used in this fashion.
MB> 0 to 10 are (optional) exceptions as a compromise.
0..10 are NOT optional. There's no way to disable them.
MB> Fake enums using
MB> integers constants were common, and that's the reason these
MB> exceptions exist, I believe.
Hmm, shouldn't fake enums use static finals? Don't use them, so don't know
how they are declared/defined.
MB> I doubt 100 and 1000 are used in this fashion.
Nope. I have lot's of places where I use multiplications and divisions by
100 and 1000 (scaling operations) and replacing these with x * ONE_HUNDRED
or x * ONE_THOUSAND hardly makes the code more readable/understandable. Putting
coments in code disablling the inspection in those cases doesn't help much
either.
Carlos
My point is that your use of 100 or 1000 probably isn't "any number", like most uses of 0..10. They probably have some business meaning, and should have a proper name.
That being said, maybe this inspection should have a configurable option to add further exceptions.
name them _1000 and _100
problem solved :)