TIP: NetBeans: removing trailing whitespace (to meet the Drupal Coding Standards and pass Coder/PHP_CodeSniffer)

Keywords

This works for removing trailing whitespace in NetBeans 8.0 (Mac version):

NetBeans > Preferences > Editor > On Save > Remove Trailing Whitespace From: All Lines 

Make sure you have:

Language = PHP

And you may need to deselect:

[ ] Use All Languages settings.

It was not at all obvious to me that this might be under On Save.

You have to at least perform a dummy edit then save the file for it to work.

NetBeans still seems to introduce the whitespaces on an empty next line
or empty documentation line sometimes on [ENTER]/[RETURN], but at
least it gets removed on save.

See also: http://stackoverflow.com/questions/4119872/netbeans-removing-trailing-wh...

Visit also