PHP CodeSniffer Support for Netbeans
I dived into the code of my new favorite IDE Netbeans these last days and came up with an extension module, which adds PHP CodeSniffer Support on a per file basis to make my life much easier. It shows warnings and errors as annotations to the Editor and marks the affected lines in yellow and red.
My Java skills being very bad, it will only work on Linux currently, since the PHP Code Sniffer "binary" is hardcoded into the Java Source code. You have to create a "/usr/bin/phpcs2" executable, which is a wrapper that looks like:
With Manuals extensions (see the comments) the module now works without the wrapper script. It might even work under Windows now. Yet now the Zend Coding standard is enforced though. I am working on making that one configurable next.
You can install the NBM module install file from the GitHub repository into Netbeans and it "should" work then.
I hope to get more familiar with Netbeans in the future to add some more PHP tools and enhance Code Sniffer support.
Category: PHP,
Comments (13)
Tags for this Article
Comments (13)
By the way, really great work...
Greetings
Manuel User: manuel pichler - Date: 2009/07/31 09:24
So i could live without code sniffer before and not gonna install it untill it works fine.
User: johny - Date: 2009/07/31 12:31
The plugin PHP Project is requested in implementation version 200906241340".
Am I missing something ?
Thanks in advance. User: tomas.pet - Date: 2009/08/08 19:03
I am using some PHP API that is not public yet, therefore the version is quite important. I should refactor away from the unstable API for the next version. User: beberlei - Date: 2009/08/20 21:16
Some plugins require plugin PHP Project to be installed.
The plugin PHP Project is requested in implementation version 200906241340. The following plugin is affected: phpcs2
Perhaps you can fix this problem. It occurs on Netbeans 6.7.1 on MacosX and Debian Linux.
User: viego - Date: 2009/10/03 11:51
Post A Comment
Back To The Top



Since the .nbm didn't work in 6.7.1 and in the latest 6.8 nightly, I build it myself in 6.7.1 from the git master (50ee09a6caf88e9b1e69a4896122363677e87c68), but in the latest 6.8 nightly netbeans seems to miss org.netbeans.modules.php.project.util.PhpProgram;
Current Problem running it on 6.7.1:
After running it once on a file, then changing something, running it again doesn't change any annotations.
A new "code-check" is only possible after restarting netbeans.
But it's really great to have phpcs IN netbeans :)
after phpunit in netbeans, netbeans is really getting better for php-development from day to day.
User: robo47 - Date: 2009/07/31 02:50