New Netbeans PHP CodeSniffer Plugin Version

This morning I took the time to merge several changes by Manuel Piechler into my Github branch of the CodeSniffer Plugin and released a new NBM file for you to download. Here are the changes done by Manuel:

  • Ability to specifiy the path to CodeSniffer Binary
  • Automatic Detection of all the installed Coding Standards
  • Fixed Automatic Binary Detection on Windows

The only open TODO for this project is the possibility to specify different standards on a per project basis, currently you can only choose a global standard.

Share This Post

  • Share on Twitter
  • Facebook
  • Share on deli.cio.us
  • Share on Digg
  • Share on reddit
  • Share on StumbleUpon

Tags

This post is untagged.

Comments


ingo
Apr, 18. 2010

Hey, cool!

A big thank you.



fqqdk
Apr, 18. 2010

Cool! Thanks!



asdf
Apr, 18. 2010

God bless you!



jeffrey rubinoff
Apr, 20. 2010

Linked you from http://blogs.sun.com/netbeansphp. Tried sending a trackback but got "Trackback failed, url indicated success but response message was improperly formatted."



thomas
Apr, 20. 2010

Bugs:
- changing the coding standard requires restart of IDE
- causes ClassNotFoundException on startup and blocks + hot-key after IDE-restart

Tested with daily build NetBeans 6.9 19-04-2010 12-04-18 on Windows XP



thomas
Apr, 20. 2010

I found the ClassNotFoundException is related to an incompatibility with the latest version of the "Scan on Demand" plug-in. Installing both will cause the exception and prevent the IDE from loading any further plug-ins.



thomas
Apr, 20. 2010

I tried the CodeSniffer plug-in with a fresh vanilla installation of NetBeans 6.8 stable. So far it does work.

Not perfect though: violations are not shown in task list and you may not scan full directories. I suppose this was intended to work - but somehow it doesn't - unless I'm doing something wrong.



cieszak
Apr, 20. 2010

Works for me (Windows+xampp+netbeans 6.8), but I must run netbeans first time from xampp shell console for list of standards list to be filled



thomas
Apr, 21. 2010

As I mentioned in the mail already, diving into the inner workings of the \"Scan on demand\" plug-in (or possibly simply: mailing the developer) might tell you how to trigger a CodeSniffer scan on a directory or how to autostart it on certain events.

The information can be found here: http://wiki.netbeans.org/ScanOnDemand#How_does_it_work

Also the latest NetBeans 6.9 development builds seem to be more stable. They may be found here: http://bertram.netbeans.org/hudson/job/PHP-build/



chilicheech
Jul, 02. 2010

Using this plugin on NetBeans 6.9 on Mac OSX 10.5.8 with Java SE 6 the context menu item "Show Code Standard Violations" was greyed out. This was because phpcs' path wasn't set in the plugin's preferences. Upon attempting to set it NetBeans threw an exception. So, I manually set the path in "/Users//.netbeans/6.9/config/Preferences/de/whitewashing/php/cs.properties". The setting is:

phpcs.shellScript=/usr/local/bin/phpcs

Save the file, close and reopen NetBeans, and now the menu option is no longer greyed out and I am able to set the path in the plugin's preference pane.

Is it possible that the code is trying to set this setting without first creating it if it's not already present?

Here's the exception I was getting:

Getting this error when setting the phpcs path in the Netbeans 6.9 (MaxOSX) options (the "Standard" menu is empty):


java.lang.NullPointerException
at org.netbeans.core.startup.preferences.NbPreferences.put(NbPreferences.java:155)
at de.whitewashing.php.cs.ui.options.CodeSnifferOptions.setCodingStandard(CodeSnifferOptions.java:49)
at de.whitewashing.php.cs.ui.options.CodeSnifferOptionsPanel.store(CodeSnifferOptionsPanel.java:137)
at de.whitewashing.php.cs.ui.options.CodeSnifferOptionsPanelController.applyChanges(CodeSnifferOptionsPanelController.java:28)
at org.netbeans.modules.options.TabbedController.applyChanges(TabbedController.java:126)
at org.netbeans.modules.options.CategoryModel$Category.applyChanges(CategoryModel.java:387)
at org.netbeans.modules.options.CategoryModel$Category.access$1000(CategoryModel.java:316)
at org.netbeans.modules.options.CategoryModel.save(CategoryModel.java:215)
at org.netbeans.modules.options.OptionsPanel.save(OptionsPanel.java:207)
at org.netbeans.modules.options.OptionsDisplayerImpl$OptionsPanelListener.actionPerformed(OptionsDisplayerImpl.java:331)
at org.netbeans.core.windows.services.NbPresenter$ButtonListener.actionPerformed(NbPresenter.java:1292)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:389)
at javax.swing.plaf.basic.BasicRootPaneUI$Actions.actionPerformed(BasicRootPaneUI.java:191)
at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1638)
at javax.swing.JComponent.processKeyBinding(JComponent.java:2839)
at javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:267)
at javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:216)
at javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2916)
at javax.swing.JComponent.processKeyBindings(JComponent.java:2908)
at javax.swing.JComponent.processKeyEvent(JComponent.java:2802)
at java.awt.Component.processEvent(Component.java:6125)
at java.awt.Container.processEvent(Container.java:2085)
at java.awt.Component.dispatchEventImpl(Component.java:4714)
at java.awt.Container.dispatchEventImpl(Container.java:2143)
at java.awt.Component.dispatchEvent(Component.java:4544)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1850)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:712)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:990)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:855)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:676)
at java.awt.Component.dispatchEventImpl(Component.java:4586)
at java.awt.Container.dispatchEventImpl(Container.java:2143)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4544)
[catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:635)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:133)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)



laurens
Sep, 03. 2010

Useful plugin, thanks a lot!
The do have one problem though. The plugin does not work for my custom standard. My standard works fine command line, and all other standards work fine in the plugin. When I select my own standard however, no warnings/errors are returned when I try to apply the plugin.
Does anybody recognize this problem? I guess this problem is somewhere in the plugin, as the standard works fine commandline


Write a Comment