Comments

joachim’s picture

Status: Reviewed & tested by the community » Needs work

Wow. Huge patch!

Mostly looks fine. Just a few things:

+++ image.install	29 Jul 2010 11:14:10 -0000
@@ -155,33 +154,33 @@ function image_update_4() {
+      $ret[] = update_sql("DELETE FROM {files} WHERE fid = " . (int)$file->fid);
+      $ret[] = update_sql("DELETE FROM {file_revisions} WHERE fid = " . (int)$file->fid);

Casting should take a space according to coding standards.

+++ contrib/image_attach/image_attach.module	29 Jul 2010 11:19:54 -0000
@@ -694,9 +678,10 @@ function theme_image_attach_attached_ima
-      $classes[] = $div_attributes['class']; // incoming classes.
+      $classes[] = $div_attributes['class'];

Can you move this comment up to its own line rather that remove it entirely please?

+++ contrib/image_attach/image_attach.views.inc	29 Jul 2010 11:20:34 -0000
@@ -44,18 +45,18 @@ function image_attach_views_data() {
-      'table' => 'image_attach', // real table name
+      'table' => 'image_attach',

See below for comments in views.inc table definitions.

+++ contrib/image_gallery/image_gallery.install	29 Jul 2010 11:22:04 -0000
@@ -25,8 +25,8 @@ function image_gallery_enable() {
       'name' => t('Image Galleries'),
-      'multiple'  => 0,
-      'required'  => 0,
+      'multiple' => 0,
+      'required' => 0,
       'hierarchy' => 1,

Earlier on you're aligning array values; here you're removing existing alignment.

+++ contrib/image_gallery/views/image_gallery.views.inc	29 Jul 2010 11:28:08 -0000
@@ -311,5 +312,5 @@ class image_gallery_join_subquery extend
-} // class image_gallery_join_subquery
+}

This is an aberrant class in a file of functions. Can we keep this marker of its closing point please?

+++ contrib/image_gallery/views/image_gallery_plugin_display_image_gallery.inc	29 Jul 2010 11:31:22 -0000
@@ -48,7 +47,7 @@ class image_gallery_plugin_display_image
-      $this->gallery_terms_view->embedding_view =& $this->view;
+      $this->gallery_terms_view->embedding_view = &$this->view;

I've no idea what either notation might mean TBH and google is useless with symbols.

+++ contrib/image_import/image_import.module	29 Jul 2010 11:24:34 -0000
@@ -7,7 +7,7 @@
-      return '<p>'. t("Import multiple image files and save them as image nodes. The files will be moved from their location into the image module's files directory. Searching for image files in %dirpath.", array('%dirpath' => realpath(variable_get('image_import_path', '')))) .'</p>';
+      return '<p>' . t("Import multiple image files and save them as image nodes. The files will be moved from their location into the image module's files directory. Searching for image files in %dirpath.", array('%dirpath' => realpath(variable_get('image_import_path', '')))) . '</p>';

Might be nice while we're at it to knock that t()'s array to the next line.

+++ contrib/image_import/image_import.pages.inc	29 Jul 2010 11:26:44 -0000
@@ -306,20 +307,25 @@ function _image_import_batch_finished($s
+  // Rmove the filename at the end.

'Remove'.

+++ views/image.views.inc	29 Jul 2010 11:32:13 -0000
@@ -192,7 +192,8 @@ function image_views_plugins() {
-        'parent' => 'fixed', // so that the parent class is included
+        // Include parent class.
+        'parent' => 'fixed',

This format follows Views' own files. See modules/node.views.inc, for ex.

+++ views/image_handler_argument_image_node_image_size.inc	29 Jul 2010 11:33:15 -0000
@@ -31,24 +32,28 @@ class image_handler_argument_image_node_
-        'hard fail' => TRUE, // This is a hard fail condition
+        // This is a hard fail condition.
+        'hard fail' => TRUE,

Ditto, IIRC. And others in this file.

Powered by Dreditor.

sun’s picture

Status: Needs work » Needs review
StatusFileSize
new109.17 KB

Fixed all review issues, but these:

See below for comments in views.inc table definitions.
This format follows Views' own files. See modules/node.views.inc, for ex.

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.

Earlier on you're aligning array values; here you're removing existing alignment.

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.

- $classes[] = $div_attributes['class']; // incoming classes.
+ $classes[] = $div_attributes['class'];

Can you move this comment up to its own line rather that remove it entirely please?

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.

This is an aberrant class in a file of functions. Can we keep this marker of its closing point please?

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.

- $this->gallery_terms_view->embedding_view =& $this->view;
+ $this->gallery_terms_view->embedding_view = &$this->view;

I've no idea what either notation might mean TBH and google is useless with symbols.

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.

joachim’s picture

StatusFileSize
new109.16 KB

> 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 :)

sun’s picture

Status: Needs review » Fixed

Thanks! 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.