What version to use
For best results, use the latest development releases of this project and its dependent projects. Coder Sniffer requires PHP_CodeSniffer, see the installation instructions. For Coder Upgrade, the latter includes the Grammar Parser and Libraries API. As a developer tool, this project is not like a "typical" project for which you generally want the "recommended" releases on a production site. As a rule, the development releases of this project and its supporting projects are stable and meant to work together.
Drupal 6 and earlier versions
The Drupal 6.x and earlier versions are no longer supported. That means that you can use them and they still should be useful, but if you find any problems with them, there is no point raising an issue about them. If you really want to have support, then you will have to upgrade to Drupal 7 and use the 7.x version of the module. Alternatively, you can install drush and install coder as a drush plugin, and then you can get the latest coder review results on a 6.x code base.
The Coder project includes two developer modules that assist with code review (Coder Review maintained by douggreen and stella) and code manipulation (Coder Upgrade maintained by solotandem). Each of the modules supports a plug-in extensible hook system so contributed modules can define additional review standards and upgrade routines.
From the live site, you can upload your module code and run Coder Upgrade followed by Coder Review (on the upgraded code). In return, you get clean, standards-compliant code (from the Grammar Parser output) and a jump start on your module conversion. You can even convert SQL to the new object-based DB API with the SQL conversion tool on this site.
This module utilizes rules (mostly regular expressions) to review source code files for code that 1) needs to change due to Drupal API changes and 2) does not satisfy Drupal coding standards.
Coder Review provides 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
The following modules extend the reviews available in the Coder Review module:
This module utilizes the Grammar Parser library to modify a source code file based on its grammar. The module utilizes the growing API for code manipulation (e.g., getting, setting, inserting and deleting parameters to a function call) provided by the Grammar Parser library to modify source code in a precise and programmatic fashion. The module utilizes the familiar Drupal hook system to invoke upgrade routines (e.g., for function calls and hook functions), allowing other modules to enhance or modify a routine. Contributed modules that define an API can develop upgrade routines that would enable other contributed modules relying on that API to upgrade their code.
Coder Upgrade outputs:
- the modified source code file (with an option 1) to copy and overwrite the original file, or 2) to leave the original file unchanged and write the modified file to the output directory)
- a patch file that can be more easily reviewed for the changes made and also submitted in an issue queue.
An example (the issue is still being debated, however) of an upgrade routine to modify Drupal core files is this one for SimpleTest test files. A recent example of modifying a custom API is shown here.
The 7.x branch requires:
- the Grammar Parser (as a library, not "enabled" as a module)
- the Grammar Parser Library
- the Libraries API (2.x-dev)
The Coder module was originally developed by douggreen, partially supported by CivicActions. It is now being developed and maintained on my own time with love for Drupal. If anyone would like to sponsor faster development of the 8.x upgrade review, please contact me directly or through Tag1 Consulting.
The Coder Review module was sponsored by Annertech for several years of work. Development of the Drupal 7.x upgrade routines was partially sponsored by Clarity Digital Group (owners of NowPublic.com and Examiner.com).
The Coder Upgrade module is sponsored by Boombatower Development.