Setting up PHP CodeSniffer with NetBeans

I’m setting up phpMD / CodeSniffer into my NetBeans 7.3 on Xubuntu 12.10 again, so that I don’t have to look all the stuff up again.

First I install the plugin.

Then it complains that the underlying stuff isn’t properly configured. (Of course it isn’t as I haven’t installed anything else yet.)

Let’s start with Mess Detector, as its webpage suggests.

sudo pear channel-discover pear.phpmd.org
sudo pear remote-list -c phpmd
sudo pear install phpmd/PHP_PMD

Now NetBeans’s options dialog can detect Mess Detector and it says it works fine.
The next one will be CodeSniffer.

sudo pear install PHP_CodeSniffer

And after NetBeans detects it, I set the ‘standard’ field to ‘Zend’ instead of ‘PEAR’.

The only one that remains is Copy Paste Detector. Installing it as its webpage suggests. Note: php-unit should not be installed through apt or it would cause some problems.

sudo pear config-set auto_discover 1
sudo pear install pear.phpunit.de/phpcpd

Leave a Reply

Your email address will not be published. Required fields are marked *