Check for named constants
Eg remove $six = 6
or $week = 7
These sorts of numbers are still magic, fixes #83
Not sure why appveyor is complaining. Will take a look later. Passes travis
This should be multilingual now.
Is the complexity really worth the benefit? I mean, you can still call your constant WHATEVER and the tool won't complain. You can still do const FIRST_COLOUR=1 and it'll pass fine.
I don't think this tool can ever replace thorough code review, it can help, by ensuring there are constants for everything, but IMO deciding if the name of the constant is meaningful enough cannot be really automated.
I don't think this tool can ever replace thorough code review, it can help, by ensuring there are constants for everything
Completely agree. Since using this Ive seen more and more bad constant naming. That can not be prevented but the main cases I have seen, this will prevent that.
To be clear this check is not enabled by default, so its only if you want the additional level of checking.
FIRST_COLOUR=1 may be fine, because FIRST_COLOUR=2 may also be valid.
SIX=6 is never valid.
@sidz thoughts on getting this in soon ? It will solve lots of magic constants. I don't think it should be Included in all but as a separate flag to not suddenly include lots of magic numbers
As an idea it's ok for me so far. But we need to rebase this PR against latest master and fix all conflicts first.
Yeah was just checking that before I did that work. I'll sort the conflicts this week