Coder - Code Review

in

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".

The 5.x-dev version includes the 6.x upgrade review. The HEAD version also includes this review and works with Drupal 6.x.

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.

Please help improve coder by adding your comments to the Performance optimization support discussion.

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)
  • comment review

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.

10
Average: 10 (1 vote)

Issue Queue

Add not working

in
6.x-2.x-dev, Code, bug report, normal, active

When I go to this page
admin/store/settings/donate/manage
click on the "Add donation" tab, then Add my first and only donation, it does not go to the page.
Anything I'm supposed to do for that to work?
Thank you.
Alexis Wilke

 

CVS Commits

  • cvsuid: 
    66894
    cvscomment: 
    <a href="http://drupal.org/node/895708">#895708</a> - fix for broken function names
    cvscid: 
    413340

    commit #413340 by snpower - #895708 - fix for broken function names

  • cvsuid: 
    240748
    cvscomment: 
    coder_upgrade.function.inc: enhance #hook_filter_info (including a missed parser API change that broke the entire routine), #install-schema, #hook-user-changes, #hook_load_signature, and #theme_changes.
    cvscid: 
    413142

    commit #413142 by solotandem - coder_upgrade.function.inc: enhance #hook_filter_info (including a missed parser API change that broke the entire routine), #install-schema, #hook-user-changes, #hook_load_signature, and #theme_changes.

  • cvsuid: 
    66894
    cvstag: 
    DRUPAL-6--2
    cvscomment: 
    strengthened db_rewrite_sql rule
    cvscid: 
    410022

    commit #410022 by snpower on DRUPAL-6--2 - strengthened db_rewrite_sql rule

  • cvsuid: 
    66894
    cvscomment: 
    strengthened db_rewrite_sql rule
    cvscid: 
    410020

    commit #410020 by snpower - strengthened db_rewrite_sql rule

  • cvsuid: 
    66894
    cvstag: 
    DRUPAL-6--2
    cvscomment: 
    tweaked db_rewrite_sql() rule
    cvscid: 
    409786

    commit #409786 by snpower on DRUPAL-6--2 - tweaked db_rewrite_sql() rule