If you're using vim as your text editor, try
adding the following to your .vimrc
:
highlight RedundantWhitespace ctermbg=red guibg=red match RedundantWhitespace /\s\+$\| \+\ze\t/
Handy for telling you when there's invalid whitespace in your code. Telling
you with large, red blocks:
See also: this vim tip.