I would love to see the coder-review command run at DRUSH_BOOTSTRAP_DRUSH instead of requiring the module be enabled. This would allow for much quicker and arbitrary code reviews, outside of the context of a functioning drupal installation.

Comments

pwolanin’s picture

Seconding this - doesn't seem like the code review should depend on being inside Drupal. Ideally coder could be installed as a drush extension independent of any drupal install.

ericduran’s picture

Yeah, completely independent of Drupal would be great.

Sorry for the lame +1 :)

We can probably start by making a list of what in coder requires drupal to be bootstrapped.

steven jones’s picture

I've made a drush command that creates a temporary Drupal site, installs coder on it and does a review: http://drupal.org/project/standalone_coder_review which is a bit of a stop-gap until this issue can be sorted.

ericduran’s picture

I actually have a sandbox project where im bringin in some previous work from github. http://drupal.org/sandbox/ericduran/1337998

The drush command seems great but in short I really do think the code review process shouldn't touch or need drupal.

steven jones’s picture

@ericduran this is great, and I fully agree that you should be able to validate the code style of Drupal without bootstrapping Drupal.

I know that open source is inherently fractured, but wonder if because coder has a larger install base currently wouldn't it be better to make that runnable from a lesser drush bootstrap level. Coder itself has two implementations for checking code style, and this would be a third. While I'm not against diversification it seems that efforts to improve the existing coder solution would make more sense than developing a new one.

ericduran’s picture

@Steven Jones, Yes this totally makes sense. But what we realized is that we already had 3 different projects (excluding coder) that where actually trying to tackle the same problem. So instead of maintaing all those 3 project we decide to combine it into one.

I would love to get coder into a lower bootstrap which would benefit everyone, but at is core I think they are two completely different projects, one good example if it I want to run my syntax validator on a file I currently have open in my editor. This is a lot simpler by just running a single php command. Now this is definitely possible with with drush, but a php command is just simpler.

Also it should be noted what we're trying to do is use the same project other php projects use for syntax check. A great example of this is by using drupalcs you have out of the box support for other reporting tools such as a Jenkins plugins (Checkstyle, or Violations) and makes it soo much simpler to integrate with a continue integration environment such as Jenkins, bamboo, etc..

Also Coder, is great for people that might not have full access on there server and maybe just really want to check if there code is adhering to the coding standards.

In short both project are actually totally different, and I think is ok if both project live side by side for now.

douggreen’s picture

I just tested setting 'bootstrap' => DRUSH_BOOTSTRAP_DRUSH, and it appears to run fine, I've committed to 7.x-1.x-dev, but would appreciate someone double checking this doesn't cause them problems.

steven jones’s picture

In theory, this change really shouldn't work, as the command uses functions from the module and Drupal's API, that aren't available at that bootstrap level.

I wonder if you've got the coder module installed in a Drupal site and are bootstrapping drush anyway?

douggreen’s picture

yes I am, I'll work on this later, leaving open.

klausi’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Coder 7.x-1.x is frozen now and will not receive any updates. Coder 8.x-2.x can be used to check code for any Drupal version, Coder 8.x-2.x also supports the phpcbf command to automatically fix conding standard errors. Please check if this issue is still relevant and reopen against that version if necessary.