6

There's a site specifically for Code review. However, if my question is very Drupal specific, is asking questions like the following appropriate on Drupal Answers?

I wrote function/module X, please review it for Drupal best practices

  • 1
    This doesn't really fit as an answer but there is a irc channel for code reviews #drupal-codereview (maybe an s at the end). It was fairly active when I left and they would be more than happy to review code. – digital May 28 '12 at 15:00
12

If you are asking for a full module, I would say that is not fine. It would be better you focus on specific parts, especially to avoid the question becomes a wall of code that would not probably be helpful to many users.

Differently, a single function would be more acceptable, especially when it is a hook implementation. A single function is probably more re-usable, and what reported could be useful to more users.

Generally speaking, a question like, "please review it for Drupal best practices" is not even a question, but a request. The OP should make clear why the code doesn't seem right, or for which reason the OP thinks the code could be optimized.

2

A 'first' level of code review might be to use the code review module. It will review your module or really anything in the scope of where it's installed. Basically it will alert you to anything not up to drupal standards.

http://drupal.org/project/coder

I do this followed by opening up my bitbucket or github account repos to a few trusted associates.

  • Coder is certainly a great module, but in the context of reviewing ones own code, I don't know what good excuse there is to not just set up your editor to do this. All my code follows the standards before they ever get into git, as my editor points out all problems that DrupalCS can find. – Letharion May 25 '12 at 13:55
  • It is merely a first step. – Rick May 25 '12 at 13:58
  • Yes. My tone may not have been as friendly as it could have been, sorry about that. I up voted because it's a useful answer, even if my comment didn't make it sound like that. :) – Letharion May 25 '12 at 14:06
  • No worries! I didn't take it as such. – Rick May 25 '12 at 14:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .