Closed (fixed)
Project:
Image
Version:
6.x-1.x-dev
Component:
image.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
29 Jul 2010 at 11:36 UTC
Updated:
17 Aug 2010 at 18:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
joachim commentedWow. Huge patch!
Mostly looks fine. Just a few things:
Casting should take a space according to coding standards.
Can you move this comment up to its own line rather that remove it entirely please?
See below for comments in views.inc table definitions.
Earlier on you're aligning array values; here you're removing existing alignment.
This is an aberrant class in a file of functions. Can we keep this marker of its closing point please?
I've no idea what either notation might mean TBH and google is useless with symbols.
Might be nice while we're at it to knock that t()'s array to the next line.
'Remove'.
This format follows Views' own files. See modules/node.views.inc, for ex.
Ditto, IIRC. And others in this file.
Powered by Dreditor.
Comment #2
sunFixed all review issues, but these:
Those comments in Views' files are not really meant to be taken over as is; they basically just explain Views' API to developers looking for example code. Since Image module is not Views module, we do not have to explain the Views API.
Actually, I hoped that I would've reverted all alignments. That's bad style, and I only implemented in coder_format, because we have aligned stuff in a couple of places in Drupal core. Downside of any alignment is that a patch that changes one line suddenly has to touch gazillions of totally unrelated code lines.
If any re-alignment is still contained, then let's just keep it, as it must be a re-alignment of already aligned lines.
This comment does not explain anything, or it might do, but humanity does not understand what it tries to say. Or it just explains what's totally obvious from the code itself. I'm actually not sure. But in both cases, the comment either needs to be removed or entirely rewritten so that it actually explains something useful to the reader. If comments are not useful, then they are just code bloat, and people might stop reading comments at all.
Since coder_format automatically applies the coding standard to write comments above (not next) to the remarked code, this line got changed. But as the comment didn't make any sense, neither on its own nor in context of the surrounding lines and function, I removed it completely.
We do not use such closing comments anywhere in Drupal. And if we did, then the comment would have to be above the remarked line. In addition, I personally think that if an author thinks that such a comment would be useful, then something must be wrong with the entire code structure and flow, i.e., not being followable or understandable.
It's the same in this case, but in Drupal, we put the ampersand onto the pointer that is referenced, not on the assignment. Which makes it compatible with arguments passed by reference (also &$param) and other coding standards.
Only &= would be something entirely different.
--
If there's any remaining disagreement on changes in this patch, let's just remove the entire diff hunks to commit the rest.
Comment #3
joachim commented> In addition, I personally think that if an author thinks that such a comment would be useful, then something must be wrong with the entire code structure and flow, i.e., not being followable or understandable.
Pretty much, yes. That class is a custom subclass that we force into Views. It's a hack! ;)
Ok on indentation changes and Views comments.
> - $classes[] = $div_attributes['class']; // incoming classes.
I've added a proper comment higher up to explain what's going on. I think theme functions especially need clear comments so people who are not that skilled in PHP can follow them and make changes to them.
Here's a patch with just the 'incoming classes' comment changed. You can go ahead and commit this :)
Comment #4
sunThanks! Committed to 6.x and HEAD branches.
A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.