Menu

[r323]: / wiki / UsingWithEclipse.wiki  Maximize  Restore  History

Download this file

36 lines (25 with data), 1.5 kB

= Using PHPCheckstyle with Eclipse =

Eclipse is already able to do some checks and to reformat your code (CTRL + SHIFT + F) with [http://www.eclipse.org/pdt/ PDT].

It is also possible to add some extenal tools like PHPCodeSniffer or PHPCheckstyle to verify the code you're editing.

  * First, install the Eclispe PHP Tool Integration (see http://www.phpsrc.org/wiki/). Get the "PHP Tool Integration Core" package.

Eclipse Update URL : http://www.phpsrc.org/eclipse/pti/

  * Get last version of PHP Checkstyle.

  * If needed configure the PHP executable path in Eclipse (Preferences->PHP->PHP Executables).

http://phpcheckstyle.googlecode.com/svn/wiki/images/eclipse_php_executable.PNG

  * In Eclipse, configure a new validator :
   * Preferences->Dynamic Languages->Validators
   * Click "Add..."
   * Select the "External PHP Script" type
   * Set the Path to the PHP Checkstyle "run.php" file.
   * Configure the PHP Executable to match your environment.
  * Add some arguments to the executable
{{{
--src %f --config "default.cfg.xml" --format console
}}}
  * Add some pattern rules to read the result:
   * %f info Line:%n - %m Warning
   * %f warning Line:%n - %m Warning
   * %f error Line:%n - %m Error

http://phpcheckstyle.googlecode.com/svn/wiki/images/eclipse_validator_config.PNG

And it should be OK, on your PHP Editor, right click, select "DLTK Validators" and the script should run.

http://phpcheckstyle.googlecode.com/svn/wiki/images/eclipse_menu.PNG
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.