Coder

douggreen - December 30, 2006 - 12:29
Coder module screenshot

Developer Module that assists with code review and version upgrade. The module supports a plug-in extensible hook system so contributed modules can define additional review standards.

The 5.x-2.x version adds a new UI, core support, theme support, and a cache for faster display of unchanged files. Also supports rule #severity of "minor", "normal", and "critical".

Built-in support for:

The new UI adds a search form to all pages, displays results in fieldsets, collapsing modules without problems, and adds rule severity allowing for a color and icons to highlight problem severity. The new UI also adds a few pages/tabs to easily navigate to the display of your choice (coder/default, coder/active, coder/core, coder/all). Warning, some of these pages (most notably all, but active and core also) could take a very long time and are likely to generate php timeout errors unless you increase your max_execution_time in php.ini.

Coder now supports Drush (the Drupal Shell). Install drush and coder, and type "drush help coder" for the command line syntax.

Use admin/settings/coder to define which modules to review (whether enabled or not) and then review them all at once on the single page coder. This is a handy way to review all of your modules from a single page. If you use includes, this is not a complete picture. You should use the module review page at coder/yourmodule to see review your module and include files (.inc) in the same directory (or below) as your module.

Additional reviews and hook_reviews

Additional reviews can be defined by custom modules by defining a hook_review in the same format as the built-in reviews (see includes). The hook should return an array of review arrays. Each review array should define #title, #rules, and an optional #link for linking the title to the URL (presumably, but not necessarily, a Drupal node) it is based on. The #rules is an array of rules. Each rule should define a #type, #value, and #warning (except for callbacks). Currently supported types are 'regex', 'grep', and 'callback'.

Hints

  1. Coder only displays modules that have been registered by Drupal's module page. Thus, when upgrading to 5.x, if you want to use coder on a 5.x install, you should create the .info file. Or, you can use coder on a 4.7.x install and select the 5.x review. In either case use admin/build/module to register your module (no need to enable it), admin/settings/coder to select the 5.x review, then coder/yourmodule to review your module.

Todo

  • Performance optimization support
  • improve the security built-in review -- this is one place that coder could generate some very high value, finding security problems instead of just coding violations, or assisting with upgrades (as it does now)

If you happen to write any of the above reviews, please submit them to the coder issue queue.

Additional Resources

http://cvs.drupal.org/viewcvs/drupal/drupal/scripts/code-style.pl
http://cvs.drupal.org/viewcvs/drupal/contributions/tricks/code-checker/

This module is partially supported by CivicActions.

Releases

Official releasesDateSizeLinksStatus
6.x-1.02008-Aug-2965.76 KBRecommended for 6.xThis is currently the recommended release for 6.x.
5.x-2.82008-Aug-2955.75 KBRecommended for 5.xThis is currently the recommended release for 5.x.
4.7.x-1.22007-Jan-1616.02 KBRecommended for 4.7.xThis is currently the recommended release for 4.7.x.
Development snapshotsDateSizeLinksStatus
6.x-1.x-dev2008-Aug-3165.35 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.
5.x-2.x-dev2008-Aug-3155.74 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.
 
 

Drupal is a registered trademark of Dries Buytaert.