What about feeding the code to RBConfigurableFormatter before merging so it matches the target style, and then there would be no need to worry about whitespace?
Also I have yet to see someone using spaces for indentation and trailing whitespace (empty lines included) is usually trimmed (but then again people do use different styles so it might not apply).
Peter