Closed (fixed)
Project:
Spam
Version:
6.x-1.x-dev
Component:
Code
Priority:
Minor
Category:
Task
Assigned:
Reporter:
Created:
24 Dec 2010 at 07:05 UTC
Updated:
9 Jan 2011 at 05:50 UTC
Jump to comment: Most recent file
Hi Jerome,
I just started on the code review and discovered a little problem in the statistics. Nothing major since it is most certainly always called with the right operation. However, a bad operation should not be accepted and when so detected the function should return.
See patch for more info.
Thank you.
Alexis
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | spam-6.x-statistics_operation2.patch | 6.38 KB | AlexisWilke |
| #2 | spam-6.x-statistics_simplification.patch | 6.89 KB | AlexisWilke |
| spam-6.x-statistics_operation.patch | 639 bytes | AlexisWilke |
Comments
Comment #1
gnassar commentedCan't hurt, I guess, even though we don't ever even call update_statistics with the $op parameter defined. But I think you'd still want spam_log to record the attempted update (as in the line after the return). So perhaps dupe that line before we break out of the function.
Also, if we're being picky, the function should probably be named _spam_update_statistics -- prefixed with the underscore, as it shouldn't be being called externally.
Comment #2
AlexisWilke commentedIn that case I propose that we simplify the function because that's totally useless to support totally unused stuff (unless you know for sure that's going to be used in the near future?)
I copy the new version here as it is a bit harder to read in the new proposed patch.
Thank you.
Alexis
Comment #3
gnassar commentedSorry, but I believe the burden of proof goes in the other direction. Unless you think that the functionality will *not* be used, a substantive patch to remove said functionality isn't appropriate to the ticket.
So we can discuss whether that functionality would ever be used, or we can move the line and apply the patch.
Frankly, considering this is an error-check on a limited number of internal calls all of which we know ahead of time, this is a very trivial point to be spending a lot of time on, so I wouldn't be particularly keen on doing a thorough dissection of whether we ever need a minus case on statistics. This should be a one-minute fix, not a ten-minute discussion.
Comment #4
AlexisWilke commentedOkay, I moved the log call, added the underscore and the return statement and it is checked in.
Thank you for the review.
Alexis
P.S. It looks like you like to have the commit references... 8-)
http://drupal.org/cvs?commit=469604
Comment #5
gnassar commentedIt's not about having commit references -- it's about issues not going from "needs work" to "fixed." A patch should be submitted to the ticket and RTBC'd, even if that's just one person taking a look at it as a sanity check.
Like on this one. :) It's not a big deal, but it would be nice if it logged at the right time. The standard is, log immediately *after* the operation. Again, this piece is really minor, so it's not worth going back and fixing compared to time with the rest, but the log line should occur after the event. Just good standard practice.
So (this being pseudocode off the top of my head):
Sorta like that.
Again, the big deal here: ticket -> patch -> third-party OK -> commit. Can't skip those middle steps.