Coder
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:
- Drupal Coding Standards and a first attempt on the Drupal Commenting Standards
- Converting 5.x modules to 6.x (best), 4.7.x modules to 5.x (better), 4.6.x modules to 4.7.x (basic)
- Handle text in a secure fashion (very basic, need works, but what it finds is good), Performance Review (under development)
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
- 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 releases | Date | Size | Links | Status | |
|---|---|---|---|---|---|
| 5.x-2.7 | 2008-Feb-19 | 45.98 KB | Download · Release notes | Recommended for 5.x | |
| 4.7.x-1.2 | 2007-Jan-16 | 16.02 KB | Download · Release notes | Recommended for 4.7.x | |
| Development snapshots | Date | Size | Links | Status | |
|---|---|---|---|---|---|
| 6.x-1.x-dev | 2008-May-08 | 61.96 KB | Download · Release notes | Development snapshot | |
| 5.x-2.x-dev | 2008-May-08 | 54.33 KB | Download · Release notes | Development snapshot | |
