Posted by mariano.barcia on July 16, 2014 at 10:20pm
Last updated by mariano.barcia on Tue, 2015-06-23 23:52
Last updated by mariano.barcia on Tue, 2015-06-23 23:52
Attached you will find a code formatter for Eclipse Luna 4.4, compatible with the Drupal coding standards.
Install
You can import this formatter by uncompressing the XML file, and going to
Preferences -> PHP -> Code style -> Formatters -> Import
Usage
Say you are editing a Drupal .module. You can now right-click, Source->Format (Ctrl-Alt-F) and Eclipse will format your source code automatically to comply with Drupal Code Quality checks.
Also, you will find a code formatter for Eclipse PDT 3.8 (or Zend Studio 6.3).
| Attachment | Size |
|---|---|
| Drupal coding standards.xml.gz | 1.77 KB |
| Drupal coding standards for Eclipse Luna.xml_.gz | 1.83 KB |
Comments
Some issues
Hi Mariano, great work on the Eclipse formatter. I have found some problems though:
Correct:
Becomes:
$test = t('This is a split string' . ' to make things look' . ' nicer in the code.' );Becomes:
$test = t('This is a split string' . ' to make things look' . ' nicer in the code.');Hi, I use an improved version
Hi,
I use an improved version now, for Eclipse Luna.
The first case is fixed, however the last comma always gets removed, breaking a rule in PHPCS.
Attached the newer version, HTH.