Closed Teloah closed 8 years ago
I fixed a couple of bugs in CountRule
and ClassPerFileRule
, but am waiting for this PR to be accepted or rejected first.
I will review today
I can not see problems in changing the signature. Now it's clear the meaning of the arguments. And we can always go back if something goes wrong. Thank you
I started to learn what information I have available in the rule's
visit
method. And the first intriguing thing was that mysticalObject data
that's received, used only inaddViolation
call and then returned back. So I found the only place wherevisit
gets called to see what's really passed in. And found out that it is an instance ofRuleContext
. Also I noticed that return value is not used, which means thatreturn data;
line in the rule is meaningless. So I updated the signature to match the way it really is used.Then I noticed that the same pattern of receiving plain
Object
and then casting it to the real type ofRuleContext
is used a little below in 3addViolation
methods. Again, I saw no bonus to do that (and nothing else can be passed in anyway, cause then we'll immediately getjava.lang.ClassCastException
, right?) and updated the signature to match the reality.And all the tests still pass, so why not?