Hi,

> What is the 1.5? We should try and not use any magic numbers/strings.

A few lines above is the following comment.
 // We want invalid char and invalid format errors to show in preference
// so give wrong length errors a higher value

Re magic number string I agree in general but in this case my reasoning at the 
time was not to as:
1. It totally internal to that one function
2. It's only used in one place and I can't see the potential for it to be used 
elsewhere 
3. It actually value is meaningless (just has to >1 and <2)

It is possible that this  would be a tiny bit clearer.
Number(invalidFormat) + Number(invalidChar) + Number(incorrectFormat) + 
Number(wrongLength) * IMPORTANT_ERROR

If you look at the other validators they have hard coded strings and values all 
over the place. This code is most likely of a higher standard that what already 
exists in the Flex SDK both as originally submitted and with all the changes 
based on feedback.

If it really offends anyone that much please submit a patch :-) And don't 
forget to run the unit tests!

Thanks,
Justin

Reply via email to