this started in #595930: from github to d.o cvs(aka start 6.x-2.0-dev and get access)

quoting sdboyer:

BTW, there's been movement on coding standards since I think we last talked - http://drupal.org/coding-standards and http://drupal.org/node/608152 . Yes, more Crell (and me) :) I see why we were using them - indicating a public method that is really only intended to be called by the backend - but I'd still rather we use something other than underscores. I like your idea:

In this case, like other "underscored methods", I use it for forcing a "good" workflow, letting a fallback; but maybe is a good idea to rename the underscored method to a with a new "identifier"/name instead of _

So, we need to evaluate a good way to follow standards as much as possible and also and mainly letting the code to be as understandable as possible.

Comments

marvil07’s picture

Issue tags: +git phase 2

After #879858: Unify entity C(R)UD most of underscored methods are changed to backend<crud_operation>(), so less things to do here.

Leaving this open to actually make a review across all the code and another one with coder module.

marvil07’s picture

Title: review if we are following code standards for classes » Code standards review
sdboyer’s picture

Status: Active » Postponed

We should have an outside party do this (and a security review) prior to stable release, but not just yet.

sdboyer’s picture

Wow, this is the least critical path issue marked git phase 2 that i've untagged today :)

marvil07’s picture

let's do this review before 6.x-2.0

marvil07’s picture

Not a blocker, but let's do this before opening a 7.x-2.x (leaving the tag only to remember that)

tizzo’s picture

Assigned: Unassigned » tizzo

Taking this.

tizzo’s picture

Status: Postponed » Needs work
StatusFileSize
new23.89 KB
marvil07’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Needs work » Needs review

The patch is for D7 I think(applies there), let the bot try it.

marvil07’s picture

Status: Needs review » Needs work

Sorry for the noise, I do not know why testbot is not triggering the coder review for versioncontrol branches nor patches. Back to original state.

marvil07’s picture

Status: Needs work » Needs review
marvil07’s picture

Status: Needs review » Needs work

Sorry for the noise again. After talking with jthorson, now I have it clear: testbot runs coder review only for branches, not for patches, and that seems to be disabled from time to time, so I guess it's not reliable.

After running it locally I see this patch makes a good progress, but it's halfway there, so moving back to original state.

tizzo’s picture

This passes coder review on "normal" and fixes a number of the things in "minor". I think this is ready to be committed as a big improvement though we may want to clear up "minor" violations as well.

tizzo’s picture

Status: Needs work » Needs review
StatusFileSize
new51.42 KB

This patch passes all minor issues as well with the exception of classes being camel case in the case of views handlers. We are consistent with views which is not consistent with Drupal coding standards. I'd prefer to keep it that way.

marvil07’s picture

Issue tags: +Needs backport to D6
StatusFileSize
new10.92 KB
new59.02 KB

Thanks for taking the time to push this :-)

+++ b/commitlog/includes/views/commitlog.views_default.inc
@@ -10,14 +10,14 @@
-      $view_name = substr($file->name, 0, strrpos($file->name, '.'));
+      $view_name = drupal_substr($file->name, 0, drupal_strrpos($file->name, '.'));

There was a minor bug here, drupal_substr() exists, but drupal_strrpos() not.

+++ b/includes/views/handlers/versioncontrol_handler_field_operation_message.inc
@@ -26,10 +26,10 @@ class versioncontrol_handler_field_operation_message extends views_handler_field
-    return preg_replace('/#(\d+)\b/ie',
-      "strtr('<a href=\"!url\">#\\1</a>', array('!url' => strtr(\$this->options['issue_tracker_url'], array('%issue_id' => \\1))))",
-      htmlspecialchars($message)
-    );
+    $matches = array();
+    preg_match('/#(\d+)\b/i', $message, $matches);
+    $link = str_replace('%issue_id', $matches[1], $this->options['issue_tracker_url']);
+    return l($matches[0], $link);

Sadly, that code is not really equivalent to the original one. It is a multi-replace, we can not assume one issue ;-) and we need to link the id and actually show all the message, which is not happening after that hunk.

I wrote a little piece to avoid e preg_replace() modifier.

Also, I added some more minor doc issues for coder to be happier.

I'll add it after bot re-confirms it.

marvil07’s picture

Status: Needs review » Fixed
Issue tags: -Needs backport to D6
StatusFileSize
new60.53 KB

Added to 7.x-1.x and to 6.x-2.x after some minor conflict resolution.

It feels so good to close 2 years old issues, thanks Howard!

The patch applied to D6 FTR.

tizzo’s picture

Good call on the matching logic. I should have caught that. Thanks for the fix!

Status: Fixed » Closed (fixed)
Issue tags: -git phase 2 leftovers, -versioncontrol-6.x-2.0-release-blocker

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

  • Commit 6d2209a on 7.x-1.x, drush-vc-sync-unlock authored by tizzo, committed by marvil07:
    Issue #723962 by tizzo, marvil07: Code standards review.
    

  • Commit 6d2209a on 7.x-1.x authored by tizzo, committed by marvil07:
    Issue #723962 by tizzo, marvil07: Code standards review.