PHP CodeSniffer for Netbeans v0.2
I finally found some time to spend some time on the PHP CodeSniffer for Netbeans plugin. Previously the plugin used an unnecessary API which restricted the use to Netbeans 6.7.0 only. This API was removed so that the plugin should now work with all Netbeans Versions >= 6.7.0.
Additionally when working the previous version would scan every PHP script on a file per file basis when the all projects or main projects filters were activated. This rendered made the plugin almost useless. In the current version scans of filters that contain more than one file are blocked. That means you will only see Coding Violations when you enable the "Current File" filter. Using any other filter will just do nothing and won't put your Netbeans in permanent hibernation mode (aka useless mode).
There is also some preference "phpcs.codingStandard" using the NbPreferences API which allows to configure the coding standard. However this feature was contributed by Manuel Piechler and I don't yet understand how I can manipulate it. Maybe someone knows how (*Looking in Mapis general direction*)? By default the Zend Coding Standard is used.
Update: Coding Standard can be changed by hacking into the config file .netbeans/6.7/config/Preferences.properties setting "phpcs.CodingStandard=
Category: PHP,
Comments (17)
Comments (17)
Sucks! I am looking into it this evening, bare with me please :-) Being a Java/Netbeans noobie its quite hard to know where to look and configure ;-) User: beberlei - Date: 2009/10/06 10:08
1. Download plugin from http://github.com/beberlei/netbeans-php-enhancements/
2. Run Netbeans atleast 6.7 (plugin its not working with 6.7.1 as you can read),
3. Select menu "Tools - Plugins", then go to "Downloaded" section and select file by clicking and "Add Plugins" button,
4. Proceed instalation,
5. HF :-) User: stloyd - Date: 2009/10/06 11:06
- HisKindomComes - User: hiskingdomcomes - Date: 2009/10/06 15:49
- HisKingdomComes - User: hiskingdomcomes - Date: 2009/10/06 16:10
Caused: java.io.IOException: Cannot run program "C:wampbinphpphp5.3.0phpcs" (in directory "C:wampwwwtodomanagerpublic_htmlprotectedcontroller"): CreateProcess error=.....
phpcs.bat is a DOS-Batch (.bat) file and won't execute as a Windows 32 executable. If I strip the extension, I've to rename the phpcs which is a PHP file that handles the call to the PHP_Code_Sniffer libraries.
I don't know how to solve this. I would love to use this functionality, but for now I just do it on the commandline.
BTW, is it possible to pass along the standards to sniff?
Thanks.
- HisKingdomComes - User: hiskingdomcomes - Date: 2009/10/06 16:28
It would be great to be able to configure the standard to sniff.
I've been tinkering with properties files under config/Preferences with no luck :-S
Anyone? User: nubeiro - Date: 2009/10/06 16:57
Now the problem is that the plugin overwrites user configuration :-S
Already opened an issue on github repository (thought that would help)
User: nubeiro - Date: 2009/10/07 09:30
Find the phpcs file (no extension). Actually this is a PHP file, so add the extension (.php) to it. Open up the phpcs.bat file and modify the line where it calls the phpcs file (no extension) by adding the extension you just added. This way the bat file will correctly call the phpcs.php file and not get in conflict with the Netbeans call to a Win32-application phpcs executable.
Then, download a bat-to-exe converter from Fatih Kodak. It's freeware, very simple and effective. The phpcs.bat is very simple so it should convert properly. You can first run the converter through a anti-virus scanner to see it is a clean file. I've downloaded the converter from Fatih's own website: http://www.f2ko.de/English/b2e/index.php
Let the converter create a phpcs.exe file in the same directory as the phpcs.bat file. Leave it as is. No further changes should (have to) be made.
Go back to your Netbeans and Right-Click on your file in the editor and choose "Show Code Standard Violations" and see if it works. You shouldn't get any warning on the right-bottom anymore.
NOTE: I use Netbeans 6.7.1 on Vista with PHP 5.3.0 and the most recent PHP Codesniffer (1.2.0 stable) from PEAR.
I hope this helps!
- HisKingdomComes - User: hiskingdomcomes - Date: 2009/10/07 11:07
- HisKingdomComes - User: hiskingdomcomes - Date: 2009/10/07 14:36
- HisKingdomComes - User: hiskingdomcomes - Date: 2009/10/07 14:38
Its a great thing to check the code maschinable but only with my own coding standards. User: maikl - Date: 2009/10/15 11:50
I try to "Add Plugins" but I see nothing. User: b_aaa_b - Date: 2009/11/27 16:24
Post A Comment
Back To The Top

